In launchSlaveProcess the current code is
bool ChildProcessMaster::launchSlaveProcess (const File& executable, const String& commandLineUniqueID, int timeoutMs, int streamFlags)
{
connection = nullptr;
jassert (childProcess.kill());
const String pipeName ("p" + String::toHexString (Random().nextInt64()));
StringArray args;
args.add (executable.getFullPathName());
args.add (getCommandLinePrefix (commandLineUniqueID) + pipeName);
if (childProcess.start (args, streamFlags))
{
connection = new Connection (*this, pipeName, timeoutMs <= 0 ? defaultTimeoutMs : timeoutMs);
if (connection->isConnected())
{
sendMessageToSlave (MemoryBlock (startMessage, specialMessageSize));
return true;
}
connection = nullptr;
}
return false;
}
I reckon It should be
if (connection->isConnected())
{
return sendMessageToSlave (MemoryBlock (startMessage, specialMessageSize));
}
Here's my scenario, I started a child process, this child process has copy protection on it that stops it from even initializing if it fails, the sendMessageToSlave was always returning true. Which meant all the sendMessageToSlave were blocking.
I reckon you could simulate this by launchSlaveProcess any binary file(it doesn't need to initialize a ChildProcessSlave
Actually... this is better... so it can fall through and kill the connection
if (childProcess.start (args))
{
connection = new Connection (*this, pipeName, timeoutMs <= 0 ? defaultTimeoutMs : timeoutMs);
if (connection->isConnected())
{
if (sendMessageToSlave (MemoryBlock (startMessage, specialMessageSize)))
{
return true;
}
}
connection = nullptr;
}
return false;
Actually, nope.. none of this works well at all... it ends up blocking somewhere, even after killing threads by force... I guess the lesson is... make sure the child process you launch initializes properly! (MacOSX)
