I am using Boost to asynchronously create a process in Linux as follows:
#include <boost/process/async_system.hpp>
#include <boost/process/io.hpp>
...
namespace bp = boost::process;
boost::asio::io_context ioctx;
bp::async_system(
ioctx,
[](boost::system::error_code errorCode, int rc) {
}, // don't need an exithandler
cmd,
bp::std_out > stdout,
bp::std_err > stderr,
bp::std_in < bp::null);
I am wondering if there's way to get the pid for the child process that was created. I don't see any indication of this in the Boost documentation. Note that I'm using async_system because this child process is a long-running process that will last as long as the parent process' lifetime. If there's no way to get the child pid in this case, is there anything else available that I can use to create a process instead that would provide that info?