Just to report back what I come up with (ideas stolen from Perl Cookbook and the Perl command reference)
use strict; use warnings; use IPC::Run; use POSIX qw(:signal_h :errno_h :sys_wait_h); use Config; ... my $has_nonblocking = $Config{d_waitpid} eq "define" || $Config{d_wait +4} eq "define"; if ($has_nonblocking) { $SIG{CHLD} = \&REAPER; sub REAPER { my $pid = waitpid(-1, &WNOHANG); # wait for any child, return PID +if state changed else return 0 if stopped or -1 if error if ($pid == -1) { # ignore } elsif ( &WIFEXITED($?) ) { # true if exited normally print "$pid exited.\n"; } else { # must have been some stop signal or no change in state print "False alarm $pid.\n"; } $SIG{CHLD} = \&REAPER; } my $pid = fork(); defined $pid or die $!; unless ($pid) { my @args = ( ... ); run \@args or die $?; exit; } my $kid; do { $kid = waitpid(-1, &WNOHANG); } while $kid > 0; } ... exit;
Please comment and give advice. Thank you.

In reply to Re: External program called via system does not come back by RuntimeError
in thread External program called via system does not come back by RuntimeError

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.