Help for this page

Select Code to Download


  1. or download this
       if( $pid = fork ) {
            alarm $timeout;
            waitpid( $pid, 0 );
    ...
        else {
            exec( $command ) || die( "Couldn't exec $command" )
        }
    
  2. or download this
            defined( my $cpid = fork) or die $!;
            $cpid or exec $command;
            alarm $timeout;
            waitpid( $pid, 0 );
            alarm 0;