If I create a Scala REPL via Tools | SublimeREPL | Scala, all is well. However, if I close the tab containing the REPL, the Scala process is left running.
I've checked a few of the other REPLs and they all seem to be dying properly when the tab is closed, so this behaviour appears to be specific to the Scala one.
Oops, sorry. This is on OS X 10.7.3 with Scala 2.9.1.final.
Hmm. I know there is a problem with that on Windows for repls launched using .bat-s. SublimeREPL sends SIGTERM when tab is closed, and the cmd.exe that was running that bat dies correctly but the process itself is left running.
It should not happen on osx though... I'll take a look.
Thanks. I just confirmed that the shell process dies, but its subprocess doesn't.
Seems to be a known issue on OS X:
The main suggestion is to kill the process group, rather than just the top process.
to subprocess.Popen() should fix this on oxs/linux. During SublimePTY development I noticed that it's crucial for correct signal propagation down the process tree.
I think I'll also add a "soft_kill" i.e. sending a configurable quit command to subprocess just before SIGTERM.
I am seeing the same behaviour if I add that to arg to the subprocess.Popen call.
Having a configurable quit command seems to be a flexible approach.
add soft_quit option to suprocess repl
soft_quit is always sent to preocess just before termination, 'fixes'
issue #17 in a platform independent way w/o lost of hacks
I decided to go with the soft_quit solution, it is not 100% effective, but at least cross platform and easy to understand
Sounds good to me. Thx.
note to self: Check if killableprocess fixes this on OSX (if .killpg is used)