Repository navigation
awk: exit with 1 when the program does not parse - #191
Merged
Merged
Conversation
Alonely0
approved these changes
Nov 19, 2026
Alonely0
left a comment
Collaborator
There was a problem hiding this comment.
Hello! Thanks for the fix! Looks great, but I will rebase the branch and push a commit since the signature of exit_err changed after the last merge.
sylvestre
reviewed
Nov 19, 2026
Alonely0
force-pushed
the
fix/syntax-error-exit-status
branch
from
November 19, 2026 23:50
25afecb to
f8bf1a4
Compare
Alonely0
approved these changes
Nov 20, 2026
Collaborator
|
Thank you so much for your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #165
When the program did not parse,
uu_mainflushed the diagnostics and returnedOk(()), soawkexited with 0 andawk '...' || handle_errornever saw the failure. It now exits throughexit_errwithEXIT_FAILURE(1), the status for errors before the program runs (as discussed in #184; fatal runtime errors exit with 2 since #186). The diagnostic output is unchanged.This covers both a program given on the command line and one read with
-f, since both go through the sameErr(diagnostics)branch.Tests
syntax_error_exits_one: the issue's program plus three other syntax errors (print (, an unclosedBEGIN {,$without an operand); each exits with 1, prints nothing on stdout and reportsSyntax error.syntax_error_in_a_program_file_exits_one: the same through-f bad.awk.syntax_error_does_not_run_the_program: a syntax error inENDstops the program before itsBEGINrule runs.Without the change in
src/main.rs, all three fail.cargo test --workspace: all passcargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warnings