ChildProcessSlave same executable?



I try to figure out ConnectedChildProcess but i can not make it work. Before to go deeper in debugging, i want to eliminate obvious errors. So, just to remove a doubt, is the ChildProcessSlave launched by the ChildProcessMaster supposed to be "the same app" (like in the DEMO example)? Or can i launch a totally different remoted executable (as i unsuccessfully try)?



It doesn't care whether the exe is the same or different, it just launches whatever you tell it to.


Thanks for the confirmation. 

It seems i found where is the problem in my code. Opening the pipe in WRONLY mode blocks the main thread (it occurs at first time the connection is wrote to) when i launch the slave process. I'm not used with named pipes so i'll investigate a bit more to understand what's hap.


Ah! This is interesting because we've had reports of a tracktion bug on Windows 8 where the plugin scan child process won't start, but we couldn't reproduce it on any of our win8 dev machines.. This sounds like it's probably the same thing, so any insight you could give us would be much appreciated!

EDIT: ...ah no, WRONLY is a posix thing, so you're talking about OSX then?


Ya, it is an old brave Mac OS X 10.6 ! 

And as i'm currently trying to launch the slave from inside a Max/MSP bundle it sounds like it is something not very shareable. But sure, i'll report the solution if i found it. 


Stupid error (as always). Wrong file path provided

mMaster->launchSlaveProcess(appPath, "jojoUID");

Instead of

mMaster->launchSlaveProcess(appPath.getChildFile("Contents/MacOS/jojoSlave"), "jojoUID");

My thread was blocked as in juce_ConnectedChildProcess (line: 154) childProcess's start returns true whereas the slave executable is not properly launched...

if (childProcess.start (args))
    connection = new Connection (*this, pipeName);

    if (connection->isConnected())
        sendMessageToSlave (MemoryBlock (startMessage, specialMessageSize));
        return true;

    connection = nullptr;

...and so the write in the pipe waits for the reader for ever.

That's pretty naughty that childProcess doesn't return false in that case (and TBH i didn't investigate further to know why). 


It's actually very difficult on posix to tell whether something really launched successfully or not - I think the only way is by checking whether the process is running after forking, but that could give a false negative if the process just ran very quickly and exited correctly.

But.. I can see that other people might make the same mistake with the .app file, so I can at least add an assertion to catch that mistake.