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
Make checker script more helpful #4530
Conversation
tools/check.sh
Outdated
# Filter that exits the process if its input is non-empty. | ||
# If $* args given, prefixes each line of input with "Error: $*: ". | ||
fail() { | ||
awk -v str="$*" '/./ { if (length(str)) { print "Error: " str ": " $0 } x=1 } EXIT { exit x }' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't exit the surrounding shell, it just exits the awk script. Thus, this changes the status quo. But maybe we want all checks run, and not terminate after the first error.
But the general idea is nice. We should mix it with the "github action log commands" so that the errors are categorized as such, and colored red. Give me a little while.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I lost the || exit 1
when changing it from a sed command (as demo'd at #4529 (comment)) to an awk one.
The idea was that the awk script keeps processing all input lines, but exits with non-zero status if the input wasn't empty. I think awk '... EXIT { exit NR }' || exit
would also work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, but it needs to be END
not EXIT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it still won't work, because it exits the process at the end of the pipeline, which doesn't exit the process running the script. We need set -e
to make it exit the whole script.
46de0d9
to
ad6c768
Compare
It should work better now. |
Superseded by #4533 |
Fixes #4529