in reply to Re: waitpid and Windows
in thread waitpid and Windows

It seems to hang on the waitpid() call instead of returning immediately and moving on to the next loop step.

Replies are listed 'Best First'.
Re^3: waitpid and Windows
by syphilis (Archbishop) on Jun 03, 2007 at 07:26 UTC
    It seems to hang on the waitpid()

    It's not hanging - you're just not seeing the output.

    To see the output you'll need to run BrowserUK's code as perl -l script.pl. Alternatively, you could change the third line of the code to:
    print waitpid( $pid, &WNOHANG ), "\n" while sleep 1;;
    Cheers,
    Rob
Re^3: waitpid and Windows
by BrowserUk (Patriarch) on Jun 02, 2007 at 16:48 UTC

    Did you try running the snippet I posted above?

    Here it is as a one-liner in case you couldn't see how to run it. (You'll need to enter it as a single line.)

    C:\test>perl -MPOSIX=:sys_wait_h -le"$pid=open O, q[perl -esleep(10)|];print waitpid $pid,&WNOHANG whil +e sleep 1" 0 0 0 0 0 0 0 0 0 3204 -1 -1 Terminating on signal SIGINT(2)

    You'll need ^C to terminate it. What results did you see?

    If you can eliminate your installation and platform as a source of the problem, then you might look more closely at your implementation. Maybe post a bit more code? Including the open as I requested?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.