After experiencing several issues in relation with child processes on Mac OS X, some of which were so strange that I could not for the life of me figure out WTF was going on, I want to share my findings to everybody’s benefit here. Take these as dos and donts:
Dont attempt IPC between child processes. That is, if you fork a new process from your host or plugin directly, Mac OS will mess with our IP connections in a way that is beyond human reason. You will see killed processes still accepting connections(!) and such. Zombie sockets. Beware.
Dont attempt to scan or host plugins in a child process. You will see many plugins crash (incl. the whole new NI product line). Whether that is a Mac OS “feature”, or simply due to anti-piracy hacks of the plugin vendors, I don’t know.
There are other artifacts I remember from earlier projects, e.g. fonts not showing up in bold face where they should and such. This and similar minor oddities occur when you do not start your process correctly (no matter if it’s a child process or not).
If you want to do 1 or 2, you need to launch your “child” process as a totally separate process. You also cannot start the executable inside your app bundle directly. Although that will run and look fine, it will still crash plugins. You must launch the app with “open MyApp.app” from a shell, or you’re out of luck. It boils down to that launchd (or the Finder) need to prepare your process in order to make it a fully functional Mac OS X program. Don’t take the bare Unix route.
I vaguely remember there is a Cocoa API for launch services. It might be better than using /usr/bin/open, but I haven’t checked that yet. I’m glad I finally got my multi-process application running.
Ah, and you can’t pass command line arguments to “open”, of course Happy hacking!
Hopefully that is helpful!