Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly raise ErrorReturnCode_0 on exit code 0 #545

Merged
merged 1 commit into from
Oct 24, 2020

Conversation

ecederstrand
Copy link
Collaborator

@ecederstrand ecederstrand commented Oct 21, 2020

This handles the case where exit code 0 is disallowed via '_ok_code' and the process exits with this code.

get_exc_from_name() negates signal numbers and calls get_rc_exc() with either the exit code or the negated signal number. Exit codes are unsigned ints and thus >=0. Signal numbers are always >= 1 (see 'kill -l').

get_rc_exc() erroneously handled '0' as a signal when it should be seen as an exit code.

Fixes #544

This handles the case where exit code 0 is disallowed via '_ok_code' but the
process does exit with this code.

get_exc_from_name() negates signal numbers and calls get_rc_exc() with either
the exit code or the signal number. Exit codes are unsigned ints and thus >=0.
Signal numbers a always >= 1 (see 'kill -l').

get_rc_exc() erroneously handled '0' as a signal when it should be seen
as an exit code.
@ecederstrand ecederstrand requested a review from amoffat October 21, 2020 05:25
@amoffat amoffat merged commit 07170fe into develop Oct 24, 2020
@amoffat amoffat deleted the 544-ok-code-exception branch October 24, 2020 16:44
amoffat added a commit that referenced this pull request Oct 24, 2020
@amoffat
Copy link
Owner

amoffat commented Oct 24, 2020

Good work Erik 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

_ok_code=<none zero value> with zero return values would yield KeyError instead of ErrorReturnCode_0
2 participants