dist/tools/build_system_sanity_check: handle error by prepending

Handle putting the final error message by prepending the output.
This removes issue with errors being concatenated and gives an
interractive output.

The errors are now send to stderr.
This commit is contained in:
Gaëtan Harter 2019-06-13 15:55:15 +02:00
parent ef24df7ac0
commit 534ccaf5ee
No known key found for this signature in database
GPG Key ID: 76DF6BCF1B1F883B

View File

@ -110,19 +110,14 @@ error_on_input() {
grep '' && return 1
}
all_checks() {
check_not_parsing_features
check_not_exporting_variables
}
main() {
local errors=''
errors+="$(check_not_parsing_features)"
errors+="$(check_not_exporting_variables)"
if [ -n "${errors}" ]
then
printf 'Invalid build system patterns found by %s:\n' "${0}"
printf '%s\n' "${errors}"
exit 1
fi
exit 0
all_checks | prepend 'Invalid build system patterns found by '"${0}:" || error_on_input >&2
exit $?
}