summaryrefslogtreecommitdiffstats
path: root/tests/tests.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-10-19 09:34:58 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-10-19 09:34:58 -0400
commite527c1b288e15eadead25e01c29b5e8b074601a7 (patch)
tree1383662a61f21ec74ec1c1f2266d64bc381a1ae1 /tests/tests.sh
parentc78e5ddfc8aa0a6373b063dd787f416e9de8002e (diff)
downloadbfs-e527c1b288e15eadead25e01c29b5e8b074601a7.tar.xz
tests: Fix uses of $? with set -e
Diffstat (limited to 'tests/tests.sh')
-rwxr-xr-xtests/tests.sh22
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/tests.sh b/tests/tests.sh
index b159ea2..83f5b68 100755
--- a/tests/tests.sh
+++ b/tests/tests.sh
@@ -507,14 +507,15 @@ function bfs_verbose() {
function invoke_bfs() {
bfs_verbose "$@"
- "${BFS[@]}" "$@"
- local status="$?"
+
+ local ret=0
+ "${BFS[@]}" "$@" || ret=$?
# Allow bfs to fail, but not crash
- if ((status > 125)); then
- exit "$status"
+ if ((ret > 125)); then
+ exit "$ret"
else
- return "$status"
+ return "$ret"
fi
}
@@ -528,13 +529,14 @@ function bfs_pty() {
test -n "${UNBUFFER:-}" || skip
bfs_verbose "$@"
- "$UNBUFFER" bash -c 'stty cols 80 rows 24 && "$@"' bash "${BFS[@]}" "$@"
- local status="$?"
- if ((status > 125)); then
- exit "$status"
+ local ret=0
+ "$UNBUFFER" bash -c 'stty cols 80 rows 24 && "$@"' bash "${BFS[@]}" "$@" || ret=$?
+
+ if ((ret > 125)); then
+ exit "$ret"
else
- return "$status"
+ return "$ret"
fi
}