NAME

Runner - Run an external program through fork, with timeout and other signal management


NOT AN OBJECT

This package is NOT an object oriented package


EXPORTED FUNCTIONS

RunExt

 my ($status, $killed) = RunExt(-cmd     => $cmd,
                                -stdin   => $stdin,
                                -stdout  => $stdout,
                                -stderr  => $sterr,
                                -timeout => $timeout);
 PARAMETERS:
   -cmd     = The external command whith its parameters.
   -stdin   = The standard input, if redirected   (a file name, or anything you can pass to open)
   -stdout  = The standard output, if redirected  (a file name, or anything you can pass to open - You MUST specify > or >> in front of the name)
   -stderr  = The standard error, if redirected   (a file name, or anything you can pass to open - You MUST specify > or >> in front of the name)
   -timeout = The timeout in seconds. No timeout if -1
 RETURNED VALUES:
   $status  ==> the return value of the child
   $timeout ==> 0 if OK
                -1 if the child was killed by timeout
                -2 if the child was killed by TERM (ctrl-C, qdel, ...)

The cmd is executed, it may be killed if a TERM signal or an ALMR is received. The child is then killed with a TERM, followed by a KILL signal: it should return in any circumstance

RunExtNoWait

 my $pid = RunExtNoWait(-cmd $cmd,
                        -stdin  $stdin,
                         -stdout $stdout,
                         -stderr $sterr,
                         -timeout $timeout);
 PARAMETERS:
   -cmd     = The external command whith its parameters.
   -stdin   = The standard input, if redirected   (a file name, or anything you can pass to open)
   -stdout  = The standard output, if redirected  (a file name, or anything you can pass to open)
   -stderr  = The standard error, if redirected   (a file name, or anything you can pass to open)
 RETURNED VALUE:
   $pid ==> the process Id of the child

The cmd is executed, but the sub returns without waiting for the child's death. The children started may be killed if a TERM signal or an ALARM signal are received. The child is then killed with a TERM signal. NO KILL signal is sent to the child, terminating the child in a graceful way. If I don't have to wait, I am less violent...