How to reliably terminate a process
Simon Marlow
marlowsd at gmail.com
Thu Nov 27 04:46:20 EST 2008
Sterling Clover wrote:
> Due to the way which runInteractiveCommand works (through spawning a
> shell), it is impossible to consistently terminate a process launched
> using it. If the process tries to read from stdin, then it will die
> properly -- however, last I checked, processes blocking on reading stdin
> from within runInteractiveCommand will cause bizarre memory leaks.
>
> runInteractiveProcess will work as you expect.
The documentation for terminateProcess now includes this:
-- Note: on Windows, if the process was a shell command created by
-- 'createProcess' with 'shell', or created by 'runCommand' or
-- 'runInteractiveCommand', then 'terminateProcess' will only
-- terminate the shell, not the command itself. On Unix systems, both
-- processes are in a process group and will be terminated together.
Cheers,
Simon
More information about the Glasgow-haskell-users
mailing list