[Haskell-cafe] how to terminate a (Posix) process and all its subprocesses?
erkokl at gmail.com
Tue Jul 24 17:51:52 UTC 2018
I had a similar question a few years back using the async library and in
particular the 'race' function. I got a nice answer on StackOverflow:
I think you can use the ideas in there. Bottom line: You can use a
combination of 'onException' and 'terminateProcess' and let your spawned
processes clean-up after themselves properly.
On Tue, Jul 24, 2018 at 6:42 AM, Johannes Waldmann <
johannes.waldmann at htwk-leipzig.de> wrote:
> Dear Cafe,
> I am using
> to start an external command, and wait for its completion.
> Now I would like to time-out this after a while.
> I can use
> 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
> 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.
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe