Boost logo

Boost :

Subject: Re: [boost] [boost.process] Review
From: Klemens Morgenstern (klemens.morgenstern_at_[hidden])
Date: 2016-10-22 05:38:36

Am 22.10.2016 um 09:17 schrieb Remi Chateauneu:
> In boost.process, is there a portable way to:
> - Kill another process based on the pid ?

Yes, if you have the access rights of course. You can construct a
child-object from a pid and see which methods work.

> - Get the parent process id ?
There is not. I know there's "getppid" in linux, but there is no similar
thing on windows
> - Get the list of subprocesses ? Maybe the whole subprocesses tree ?
There is not.
> - Be notified when a subprocess crashes ?
Well, when it exits, which includes crashes. You can do that
asynchronously with boost.asio.
> - Get the current process user id or user name ?
> It should not be very difficult to implement because several of these
> features are already available in some portable Python modules (psutil
> for example).
I tried to keep to the actual APIs and implement what both platforms
provide. There are more things that can be added, especially if one is
open to use the "undocumented" api functions on windows.

I'd be happy to talk about additions to the library, but that will
happen after the review is done. The API will not change that much
anymore, so if you have ideas for additions feel free to work on them
and let me know. But keep in mind: they must be on both platforms. The
only thing where I accept extensions are the properties - elsewise you
can just use the platform-dependent stuff directly:

If the extensions are not needed in the launch-functions, you can just
use the stuff directly. I.e.

child c(...);
auto parent_id = ::getppid(;

child parent(parent_id);
parent.terminate(); //boom.

Boost list run by bdawes at, gregod at, cpdaniel at, john at