Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have a perl script that starts several child processes (via 'fork') and each of these child
processes performs a 'system' command to start another perl script.

I need to know how to detect if an error has occured within any of the 'children' perl scripts
(the errors are handled by 'die' statements).

The problem is that the 'system' command returns a value of -1 when the final child process completes,
regardless of whether an error occured.

I've checked the value of the $? variable and it is also set to -1 when the 'system' command for the
final child process returns.

How can I know if the final child process terminated normally or had errors?

Thanks.

Replies are listed 'Best First'.
Re: Capturing Error from Forked Process
by Fastolfe (Vicar) on Nov 08, 2000 at 21:49 UTC