Leopard, CoreFoundation, and exec()

pudge on 2007-11-20T22:12:52

Under Leopard, using Mac::Carbon:

[pudge@bourque ~]$ happening
Running background process /Users/pudge/bin/happening (983)
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
Apparently, fork-without-exec with CoreFoundation has always been bad. But it is now an exception.

So in the happening program, I had:
$pid = fork;
exit if $pid;


Now I have:

if (!$nofork) {
	$pid = fork;
	exit if $pid;
	exec($0, '-nofork');
}


YMMV.


Mac

djberg96 on 2007-11-21T01:21:17

You know, between my own experiences with process handling and sysctl on the Mac, comments like yours, and the lack of Java 6, I have come to one inescapable conclusion.

The Mac as a development platform is Just. Not. That. Good.

Re:Mac

pudge on 2007-11-21T05:50:38

Shrug. Works for me.

Re:Mac

sigzero on 2007-11-21T21:30:24

Lack of Java6 AT THE MOMENT doesn't mean a thing. Apple could be working on it. They just need to freaking let the community know what is going on.