Conversation
|
I think what we want is non-zero exit code if the perl exits via any of the "die" statements and a zero exit code otherwise. Not sure if setting the exit code at the end does that and/or if the END block should preserve and re-spit-out the exit code if it gets there via die. Will look at this some more. |
|
|
||
| =cut | ||
|
|
||
| exit 0 |
There was a problem hiding this comment.
I think this should be at the end of the END {} block above the docs.
There was a problem hiding this comment.
The problem with that, I think, is that END still runs after an unexpected "die", so you get zero exit status even on a failure.
There was a problem hiding this comment.
Ah good point. Sorry, never mind.
There was a problem hiding this comment.
I think maybe
END {
my $exit_status = $?;
...
exit($exit_status);
}
|
Also this code does work to output zero but it didn't start with master with the merges that are the problem. |
That's right. It started at another commit. I rebased it. |
|
Now looking better at the code it is obvious which statement is the one that sets the RC code (to 9): kill 9, $pid; # must it be 9 (SIGKILL)?
my $gone_pid = waitpid $pid, 0; # then check that it's gone |
|
I saw that nine but I wasn't 100% sure it was setting the exit code. Either way, my suggestion is in #404 . It seems to work for the success case and for the simplest "die" case of "-dir" not being a products directory. |
|
I was reading up more on appropriate handling of errors around END but maybe we don't care about best practices. |
|
Superseded by #404 |
Description
This PR sets the exit code to
0at the end of execution.I can confirm that the current master version return code is not zero. This causes
test_regress.shto fail. Someone who is more familiar with perl should check this.Interface impacts
None
Testing
Unit tests
Functional tests
I checked that the program runs and returns the given value using the same command as in
test_regress.sh:I did not check an error elsewhere to make sure the error is properly set. I would need to know what error to check for.