How to reliably terminate a process

Bernd Holzmüller bernd.holzmueller at ics-ag.de
Tue Nov 25 16:09:15 EST 2008


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


More information about the Glasgow-haskell-users mailing list