|laziness, impatience, and hubris|
DESTROY handler changes child exit status?by saintmike (Vicar)
|on May 09, 2013 at 07:04 UTC||Need Help??|
saintmike has asked for the wisdom of the Perl Monks concerning the following question:
I was surprised to find that a DESTROY handler called when an object goes out of scope changes the exit status of the child process it's running in, even if that child exits with exit(exit_code).
pid=4778 status: 255although the child exits with exit(5). So the failing system() call in the DESTROY method of the object that goes out of scope overrides the explicitly set exit() value?
(If you comment out the system() call in the DESTROY handler and uncomment the one in the child code you'll get the expected exit code 5).