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.

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.