aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2019-07-02 11:18:36 -0400
committerGraham Christensen <graham@grahamc.com>2019-07-02 11:18:36 -0400
commit68bdd83dc88ec55c6c51fa92e84e7d7d408c554a (patch)
tree70d471300c7d40fd5d5fdd595023bdb9566d2aa0
parenta52c331edba6e8c67469f53dda0be2903d18fa8c (diff)
timeout: test for error code
-rw-r--r--tests/timeout.sh12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/timeout.sh b/tests/timeout.sh
index 39ecf0a1a..eea9b5731 100644
--- a/tests/timeout.sh
+++ b/tests/timeout.sh
@@ -2,10 +2,14 @@
source common.sh
-failed=0
-messages="`nix-build -Q timeout.nix -A infiniteLoop --timeout 2 2>&1 || failed=1`"
-if [ $failed -ne 0 ]; then
- echo "error: 'nix-store' succeeded; should have timed out"
+
+set +e
+messages=$(nix-build -Q timeout.nix -A infiniteLoop --timeout 2 2>&1)
+status=$?
+set -e
+
+if [ $status -ne 101 ]; then
+ echo "error: 'nix-store' exited with '$status'; should have exited 101"
exit 1
fi