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

[ci] ensure shell script exit codes are in range 0-255 #6305

Merged
merged 4 commits into from
Feb 10, 2024
Merged

Conversation

jameslamb
Copy link
Collaborator

This PR proposes replacing uses of exit -1 in shell scripts with exit 1.

Benefits of this change

Removes reliance on shells correctly handling exit -1 (which is technically not recommended by e.g. bash) in the project's scripts.

Notes for Reviewers

From the bash docs (link)

Exit statuses fall between 0 and 255

And from the shellcheck docs (SC2242)

Note in particular that exit -1 is equivalent to exit 255, but that exit 1 is the more canonical way of expressing the first possible error code.

This change resolves the following error from shellcheck:

SC2242 (error): Can only exit with status 0-255. Other data should be written to stdout/stderr.

@jameslamb jameslamb merged commit cc733f8 into master Feb 10, 2024
42 checks passed
@jameslamb jameslamb deleted the exit-codes branch February 10, 2024 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants