in reply to system returns -1 even though command executed successfully
Here's an arbitrary example that (on my system) behaves as you describe:
$SIG{CHLD} = sub { wait }; system "date && foo 2>/dev/null"; print "ret: $?\n"; print "err: $!\n"; _END__ Tue Jan 10 17:19:35 CET 2012 ret: -1 err: No child processes
The -1 is because of the failed foo. and the "no child processes" (ECHILD) is because of the SIGCHLD reaper getting called without there being an unreaped child process (system() itself has already reaped it).
As you haven't shown what exactly you're doing, I'll leave it up to you to check for possible similarities with your code...
|
|---|