Leopard, CoreFoundation, and exec()

| | Comments (0)
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_C OREFOUNDATION_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. use.perl.org

Leave a comment

<pudge/*> (pronounced "PudgeGlob") is thousands of posts over many years by Pudge.

"It is the common fate of the indolent to see their rights become a prey to the active. The condition upon which God hath given liberty to man is eternal vigilance; which condition if he break, servitude is at once the consequence of his crime and the punishment of his guilt."

About this Entry

This page contains a single entry by pudge published on November 20, 2007 2:12 PM.

Beards was the previous entry in this site.

Ron Paul Song Outtakes is the next entry in this site.

Find recent content on the main index or look in the archives to find all content.