Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: mysterious fork() failure

by dws (Chancellor)
on Jan 05, 2002 at 01:11 UTC ( #136383=note: print w/replies, xml ) Need Help??


in reply to mysterious fork() failure

# create new directory here if (($pid = fork()) == 0) { # remove directory here } if (!defined($pid)) { # log fork() failure here # remove directory here }
You need to reverse your tests, and check for undef'ness of $pid first. For enlightenment as to why, ponder on   print undef == 0 ? "true!\n" : "false\n";

Replies are listed 'Best First'.
Re: Re: mysterious fork() failure
by Marcello (Hermit) on Jan 05, 2002 at 02:02 UTC
    So,
    if (!defined($pid = fork())) { # parent process, fork() failure } elsif ($pid == 0) { # child process, successful fork() } elsif ($justSomeVar == 1) { # parent process, successful fork() } else { # parent process, successful fork() }
    is the way to go?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://136383]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2020-02-23 02:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (102 votes). Check out past polls.

    Notices?