1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

ConnectedChildProcess: Wait for process termination on Linux to not leave zombies

This change also avoids the AudioPluginHost leaving zombie child
processes behind.
This commit is contained in:
attila 2024-01-05 17:24:27 +01:00
parent d810a168eb
commit cc60286c89
2 changed files with 14 additions and 3 deletions

View file

@ -164,9 +164,20 @@ bool ChildProcessCoordinator::launchWorkerProcess (const File& executable, const
args.add (executable.getFullPathName());
args.add (getCommandLinePrefix (commandLineUniqueID) + pipeName);
childProcess.reset (new ChildProcess());
childProcess = [&]() -> std::shared_ptr<ChildProcess>
{
if ((SystemStats::getOperatingSystemType() & SystemStats::Linux) != 0)
return ChildProcessManager::getInstance()->createAndStartManagedChildProcess (args, streamFlags);
if (childProcess->start (args, streamFlags))
auto p = std::make_shared<ChildProcess>();
if (p->start (args, streamFlags))
return p;
return nullptr;
}();
if (childProcess != nullptr)
{
connection.reset (new Connection (*this, pipeName, timeoutMs <= 0 ? defaultTimeoutMs : timeoutMs));

View file

@ -215,7 +215,7 @@ public:
bool sendMessageToSlave (const MemoryBlock& mb) { return sendMessageToWorker (mb); }
private:
std::unique_ptr<ChildProcess> childProcess;
std::shared_ptr<ChildProcess> childProcess;
struct Connection;
std::unique_ptr<Connection> connection;