Merge pull request #2350 from smcv/trap-err

libtest: On failure, make it clearer what has happened
This commit is contained in:
Colin Walters 2021-04-18 08:54:49 -04:00 committed by GitHub
commit 2458df446f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -46,6 +46,14 @@ run_exit_cmds() {
} }
trap run_exit_cmds EXIT trap run_exit_cmds EXIT
report_err () {
local exit_status="$?"
{ { local BASH_XTRACEFD=3; } 2> /dev/null
echo "Unexpected nonzero exit status $exit_status while running: $BASH_COMMAND" >&2
} 3> /dev/null
}
trap report_err ERR
save_core() { save_core() {
if [ -e core ]; then if [ -e core ]; then
cp core "$test_srcdir/core" cp core "$test_srcdir/core"