How to reliably terminate a process

Sterling Clover s.clover at gmail.com
Tue Nov 25 18:15:06 EST 2008


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.

For more information, see the bug report here:
http://hackage.haskell.org/trac/ghc/ticket/2638

Regards,
Sterl.

On Tue, Nov 25, 2008 at 4:09 PM, Bernd Holzmüller <
bernd.holzmueller at ics-ag.de> wrote:

> Hi,
>
> I am writing an application on Windows XP using ghc 6.10.1 that manages
> test cases (same applies to ghc 6.8.3). For each selected test case, the
> application runs an executable associated with the test case using
> System.Process.runInteractiveCommand. These processes have to be aborted in
> some cases, for example, when their specified termination time is up. As I
> realized, however, aborting these processes using terminateProcess is not
> reliable. Most often, the processes do not terminate correctly but have to
> be killed from the Windows Task Manager. In some cases, the process still
> produces output - in particular if I apply getProcessExitCode on the process
> just killed. By the way: calling and killing the process from the shell with
> Ctrl-C successfully kills the process.
>
> Any advice on how to reliably terminate a process on Windows?
>
> Thanks,
> Bernd
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20081125/914cef18/attachment-0001.htm


More information about the Glasgow-haskell-users mailing list