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

Match jq exit code for no output with --exit-status #92

Merged
merged 1 commit into from
Jul 17, 2023

Conversation

baodrate
Copy link
Contributor

@baodrate baodrate commented Jul 7, 2023

For compatibility with jq's upcoming (1.7?) release.

Introduced into jq with jqlang/jq#2654, when using --exit-status, parse errors now cause jq to exit with status code 5 (JQ_ERROR_UNKNOWN) instead of 4 (JQ_OK_NO_OUTPUT). The motivation is to be able to distinguish the no-output case from parsing errors.

Mirroring this, 5 will be used for both Error::Jaq and Error::Parse, i.e. both filter parsing errors and JSON parsing errors.

For compatibility with jq's upcoming (1.7?) release.

Introduced into jq with jqlang/jq#2654,
when using --exit-status, parse errors now cause jq to exit with status
code 5 (`JQ_ERROR_UNKNOWN`) instead of 4 (`JQ_OK_NO_OUTPUT`). The
motivation is to be able to distinguish the no-output case from parsing
errors.

Mirroring this, 5 will be used for both `Error::Jaq` and `Error::Parse`,
i.e. both filter parsing errors and JSON parsing errors.
@baodrate
Copy link
Contributor Author

baodrate commented Jul 7, 2023

I also added the non-zero exit conditions to the Error enum, hoping to centralize the exit codes, and to make the exit conditional more readable. Please tell me if that's unidiomatic or otherwise subpar style though.

@01mf02 01mf02 merged commit 19ae416 into 01mf02:main Jul 17, 2023
1 check passed
@01mf02
Copy link
Owner

01mf02 commented Jul 17, 2023

I also added the non-zero exit conditions to the Error enum, hoping to centralize the exit codes, and to make the exit conditional more readable. Please tell me if that's unidiomatic or otherwise subpar style though.

I like your change. :)

Thanks again!

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.

None yet

2 participants