Help for this page

Select Code to Download


  1. or download this
    >perl -MPOSIX=:sys_wait_h -le"my $pid = system 1, $^X=>(-e=>'sleep 5')
    +; while (waitpid($pid, WNOHANG) == 0) { print 'waiting'; sleep 1; } p
    +rint 'done'"
    waiting
    ...
    waiting
    waiting
    done
    
  2. or download this
    use POSIX qw( WNOHANG );
    
    ...
        die("waitpid: $!\n") if $rv == -1;
        return $rv;
    }