use strict; use warnings; use POSIX; use POSIX "sys_wait_h"; local $SIG{CHLD} = \&REAPER; my $wert = system('ls'); print "Rueckgabe: $wert\n"; if ($wert == 0) { print "Ok\n"; } else { print "Fehler\n"; } exit 0; sub REAPER { my $sig = shift; my $pid; while (($pid = waitpid(-1, WNOHANG)) > 0) { print "child $pid terminated - status $?\n"; print "sig: $sig\n"; } $SIG{CHLD} = \&REAPER; }