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

Make checker script more helpful #4530

Closed
wants to merge 1 commit into from
Closed

Conversation

jwakely
Copy link
Member

@jwakely jwakely commented Feb 26, 2021

Fixes #4529

@jwakely jwakely changed the title Make checker script more helpful and run it earlier Make checker script more helpful Feb 26, 2021
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 }'
Copy link
Member

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.

Copy link
Member Author

@jwakely jwakely Feb 27, 2021

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.

Copy link
Member Author

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

Copy link
Member Author

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.

@jwakely jwakely force-pushed the linter branch 2 times, most recently from 46de0d9 to ad6c768 Compare February 27, 2021 00:33
@jwakely
Copy link
Member Author

jwakely commented Feb 27, 2021

It should work better now.

@jensmaurer
Copy link
Member

Superseded by #4533

@jensmaurer jensmaurer closed this Feb 27, 2021
@jwakely jwakely deleted the linter branch January 22, 2022 09:12
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.

ci: more visibility of errors output by tools/check.sh
2 participants