timeout: test for error code

This commit is contained in:
Graham Christensen 2019-07-02 11:18:36 -04:00
parent a52c331edb
commit 68bdd83dc8
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C

View file

@ -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