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

I have a really interesting call-chain. There is a .Net application that spins up a batch file to run a script using the cygwin version of Perl. Very infrequently the logs indicate that the perl script aborts due to a missing file - that's actually there. The concern is that the exit code returned by the perl script is not always bubbling back to the .Net application. Does anyone know of any circumstances that would cause the exit code to be swallowed or changed to a zero? TIA -Mike
  • Comment on Perl exit code is not always bubbling up

Replies are listed 'Best First'.
Re: Perl exit code is not always bubbling up
by ikegami (Patriarch) on Feb 27, 2009 at 16:38 UTC

    It sounds like you have no doubt that Perl actually sets the error code, so this has nothing to do with Perl. I'd recommend converting the batch to bash.

    [ Intentionally left this question about batch files unapproved ]

      yes. I do believe that perl is setting the exit code correctly. I was hoping that someone knew of a set of circumstances where the exit code could be lost as it bubbled up through multiple layers. -Mike
        I was hoping that someone knew of a set of circumstances where the exit code could be lost as it bubbled up through multiple layers.

        Without seeing code, people can only guess.

        I know of one, youve been hacked by wormexitchanger which always exitcodes of all proces ... :P
Re: Perl exit code is not always bubbling up
by Jenda (Abbot) on Feb 27, 2009 at 19:25 UTC

    Get rid of the batch. If you do not want to change the perl script itself, create another in which you do whatever you used to do in the batch, set the @ARGV and do "the_script.pl";