I am wondering if there is a missing call to waitpid
in the destructor of ActiveProcess
or at least some documentation around the possibility to leave processes in defunct state if the user does not do something similar to this:
juce::ChildProcess process;
// code to start process left out
....
// Then before the `process` goes out of scope
while(process.isRunning()) {
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
const auto exitCode = process.getExitCode();
You can view processes in defunct state with ps -ef | grep '<defunct>'