in reply to Re^4: System call constantly dying
in thread System call constantly dying
In any case, I wonder whether you may have missed the point of the earlier reply from almut:
... [system()] returns the exit code (return value of the wait call) of the called program, which is typically zero upon success...
What that means is that a statement like this:
will actually cause the script to die when the system() call succeeds, because a return value of zero (false) from system() means that there was no error indicated in the exit status of the command. A less confusing idiom for doing this sort of error trapping with system() goes like this:system( $some_shell_command ) or die "bad news..."
$failed = system( $some_command ); die "bad news..." if ( $failed );
|
|---|