in reply to system function is returning status -1 when running a unix command
$ perl -wle'$SIG{CHLD}="IGNORE"; print system("ls -d ."); print $!' . -1 No child processes
system is basically fork + exec (in the child) + waitpid (in the parent). In the above example, children are auto-reaped, so system has no child to wait for, so it returns an error.
strace (or truss or whatever it's called on Solaris) would confirm this diagnosis.
Update: Added last line.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: system function is returning status -1 when running a unix command
by repellent (Priest) on Apr 08, 2009 at 18:16 UTC | |
by ikegami (Patriarch) on Apr 08, 2009 at 18:37 UTC |