1

I started using Sublime Text 3 to compile my FreeFem scripts (interpretator PDEs package solver) under Ubuntu 14.04. To invoke the interpretator I customized the build system as follows

"shell_cmd": " gnome-terminal -x sh -c \"FreeFem++ $file ; exec sh\""

Every time I run compilation I want to create a separate terminal process that launches FreeFem++. But when I press Ctrl+C it kills the terminal. Instead of this I want to terminate process but leave the terminal window open.

Alex
  • 13

1 Answers1

0

Ctrl+C kills the shell as well as the FreeFem subprocess, because the SIGINT signal is sent to the whole foreground process group. Since the shell is not interactive, the subprocess runs in the same process group. See Why is SIGINT not propagated to child process when sent to its parent process? and What is the purpose of abstractions, session, session leader and process groups? for some background on process groups.

You can cause the shell not to die when it receives SIGINT by setting a trap for it. (Don't ignore the signal: that would also cause it to be ignored by the subprocess.)

"shell_cmd": " gnome-terminal -x sh -c \"trap echo INT; FreeFem++ $file ; exec bash\""