App-ptimeout

 view release on metacpan or  search on metacpan

lib/App/ptimeout.pm  view on Meta::CPAN

    close $stderr_writer or die("Error closing stderr writer\n");

    my $deadline = time + $timeout;
    my $timed_out = 0;
    my $child_status;
    my $stderr_buffer = '';
    my $held_line;

    # Loop while the process we're monitoring does its thang
    while(1) {
        # The background process is running, and its STDERR is being captured.
        # If it's said anything on its STDERR, flush it to the *real* STDERR.
        _pump_stderr(
            $stderr_reader,
            \$stderr_buffer,
            \$held_line,
            timed_out => $timed_out,
        );

        # Has the process finished?
        my $waited = waitpid($pid, WNOHANG);



( run in 1.858 second using v1.01-cache-2.11-cpan-f56aa216473 )