I have wrote simple code that runs child process as detached:
boost::process::child childProcess
(
"sleep 10",
boost::process::std_in.close(),
boost::process::std_out.close()
);
childProcess.detach();
After the child program finishes, command "top" in ubuntu shows me this entry:
root 8935 0.0 0.0 0 0 pts/0 Z 12:10 0:00 [sleep] <defunct>
Any idea?
#edit This application will run on several operating systems. I have tried some other solutions e.g. threading:
std::thread childProcessThread([](){
boost::process::child childProcess
(
"sleep 10",
boost::process::std_in.close(),
boost::process::std_out.close()
);
childProcess.wait();
});
childProcessThread.detach();
Sometimes I get an error "free()". Is this solution correct?