in reply to system() returns -1 with $SIG{CHLD}?
My advice is to report the problem and let the porters decide if it is a bug or not. system already protects itself against other signals, and probably the infrastructure to filter some pids from wait already exists in order to handle asynchronous processes created by open FOO, '|-', ....
In the meantime...
And inside your signal handler ensure that $! and $? are localized, so that the values of this globals don't get unexpectedly changed at any place in your program.sub mysystem { my $signal_received = 0; my $old_signal_handler = $SIG{CHLD}; local $SIG{CHLD} = sub { $signal_received = 1}; system @_; $old_signal_handler->() if $signal_received; }
|
|---|