[Haskell-cafe] how to terminate a (Posix) process and all its subprocesses?
Johannes Waldmann
johannes.waldmann at htwk-leipzig.de
Tue Jul 24 13:42:32 UTC 2018
Dear Cafe,
I am using
https://hackage.haskell.org/package/process-1.6.4.0/docs/System-Process.html#v:readProcess
to start an external command, and wait for its completion.
Now I would like to time-out this after a while.
I can use
https://hackage.haskell.org/package/base-4.11.1.0/docs/System-Timeout.html
and this works in simple cases -
but not in case the external command has spawned child processes.
(cleanupProcess sends SIGTERM but only to the process at the top of
the tree ?)
I guess I need to use
https://hackage.haskell.org/package/unix-2.7.2.2/docs/System-Posix-Process.html
but that seems rather low-level - and I don't see how I would
get the ProcessID of the process started by readProcess,
so I'd also have to re-do that.
Is there an abstraction/library that would help here?
Thanks - J.W.
More information about the Haskell-Cafe
mailing list