[Haskell-cafe] how to terminate a (Posix) process and all its subprocesses?

Bardur Arantsson spam at scientician.net
Tue Jul 24 19:20:39 UTC 2018


On 2018-07-24 15:42, Johannes Waldmann wrote:
> 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.
> 

If the process is hostile (e.g. fork bomb + countermeasures), then the
*only* realiable way to do this is to use cgroups.

Obviously, this applies to Linux only. I'm not sure there's actually any
truly POSIX way to reliably kill hostile sub-processes. I don't think
so. (The progress group thing doesn't work if the process is hostile.
It'll work fine otherwise.)

Regards,



More information about the Haskell-Cafe mailing list