X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Ftesting%2Fsquelch_unless_error.sh;h=c26fd94b8e5de82f8bd5a951bbd96a6750d888b5;hb=622e52c1dfdba50cd167d31eff2749e71b5515f5;hp=b59ca5a197808d81893d8a496bd3896d166c8462;hpb=1195c9916ed0bcc0ad7cf10fc9d606d9924114b1;p=feisty_meow.git diff --git a/scripts/testing/squelch_unless_error.sh b/scripts/testing/squelch_unless_error.sh index b59ca5a1..c26fd94b 100644 --- a/scripts/testing/squelch_unless_error.sh +++ b/scripts/testing/squelch_unless_error.sh @@ -1,11 +1,13 @@ #!/bin/bash -# redirects standard out and standard error output to temp files and runs all the parameters to this script as a command. +# redirects standard out and standard error output to temp files and runs all +# the parameters to this script as a command. # if there is no error, then the files are just deleted. -# if there was an error, then the two output file are sent to standard out and standard error. -# an additional error message is sent to standard error. +# if there was an error, then the two output files are sent to standard out +# and standard error, and an additional explanatory error message is sent to +# standard error about the command that failed. -# echo "squelch args: $(printf -- "[%s] " "${@}")" +#echo "squelch args: $(printf -- "[%s] " "${@}")" newout="$(mktemp /tmp/squelch.out.XXXXXX)" newerr="$(mktemp /tmp/squelch.err.XXXXXX)" @@ -23,4 +25,7 @@ fi # clean up. \rm "$newout" "$newerr" +# pass along the error code we saw, whether success or failure, so that this command has same +# exit result as the original would have. +exit $retval