Added another safety option to bash, moved bash invocation to a separate file

This commit is contained in:
Georges Dupéron 2018-09-30 22:21:01 +02:00
parent 24d1285603
commit d5f1c26226
No known key found for this signature in database
GPG Key ID: C7976374130A80F7
2 changed files with 7 additions and 1 deletions

View File

@ -7,7 +7,8 @@ COMMIT_TIMESTAMP_ISO_8601 = $$(git log -1 --pretty=format:%ad --date=iso8601-str
####################################
MAKEFLAGS = --warn-undefined-variables
SHELL = bash -euET -o pipefail -c
SHELL = ${CURDIR}/utils/safe-bash.sh
# utils/safe-bash.sh
.SECONDEXPANSION:
Makefiles = Makefile Makefile.example-os Makefile.test-example-os

5
utils/safe-bash.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
if test "$#" -gt 1 -a "$1" = "-c"; then shift; fi
bash -euET -o pipefail -c 'trap "kill $$" ERR; '"$1"
exit $?