Fix for zombie creation with Master/Slave Child processes on POSIX

The patch below fixes the creation of zombie processes due to a missing waitpid call in the ChildProcessMaster implementation:

diff --git a/modules/juce_events/interprocess/juce_ConnectedChildProcess.cpp b/modules/juce_events/interprocess/juce_ConnectedChildProcess.cpp
index 5ca5a8110..0f892ee76 100644
--- a/modules/juce_events/interprocess/juce_ConnectedChildProcess.cpp
+++ b/modules/juce_events/interprocess/juce_ConnectedChildProcess.cpp
@@ -176,6 +176,10 @@ void ChildProcessMaster::killSlaveProcess()
         connection.reset();
     }

+    if (childProcess != nullptr) {
+        childProcess->waitForProcessToFinish(-1);
+    }
+
     childProcess.reset();
 }

Thanks for submitting this patch. Please could you provide some steps and/or example code which triggers the issue you’re seeing, so that we can verify the fix?

Ok, it basically happens, when the child process terminates for a master/slave pair. If you would now delete the master object in the parent process, it calls killSlaveProcess in the dtor, but does not call waitpid anywhere, which will keep the zombie in the process table.

I will see if I can put together a working example. It will probably take a few days.

Cheers,
Andreas