=== modified file 'bin/pt-kill' --- bin/pt-kill 2014-08-05 20:37:42 +0000 +++ bin/pt-kill 2014-08-15 17:45:18 +0000 @@ -2263,6 +2263,7 @@ use constant PTDEBUG => $ENV{PTDEBUG} || 0; use POSIX qw(setsid); +use POSIX ":sys_wait_h"; sub new { my ( $class, %args ) = @_; @@ -2289,6 +2290,13 @@ defined (my $pid = fork()) or die "Cannot fork: $OS_ERROR"; if ( $pid ) { PTDEBUG && _d('Parent PID', $PID, 'exiting after forking child PID',$pid); + # we wait 1 second to capture any early failure of child process so + # we can return a proper exit code + sleep 1; + if ( waitpid($pid, WNOHANG)>0 ) { + exit 1; + } + PTDEBUG && _d('Parent PID', $PID, 'exiting after forking child PID',$pid); exit; }