djm@openbsd.org | dd36932 | 2017-04-30 23:34:55 +0000 | [diff] [blame] | 1 | # $OpenBSD: exit-status.sh,v 1.8 2017/04/30 23:34:55 djm Exp $ |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 2 | # Placed in the Public Domain. |
| 3 | |
| 4 | tid="remote exit status" |
| 5 | |
djm@openbsd.org | dd36932 | 2017-04-30 23:34:55 +0000 | [diff] [blame] | 6 | for s in 0 1 4 5 44; do |
| 7 | trace "status $s" |
| 8 | verbose "test $tid: status $s" |
| 9 | ${SSH} -F $OBJ/ssh_proxy otherhost exit $s |
| 10 | r=$? |
| 11 | if [ $r -ne $s ]; then |
| 12 | fail "exit code mismatch for: $r != $s" |
| 13 | fi |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 14 | |
djm@openbsd.org | dd36932 | 2017-04-30 23:34:55 +0000 | [diff] [blame] | 15 | # same with early close of stdout/err |
| 16 | ${SSH} -F $OBJ/ssh_proxy -n otherhost exec \ |
| 17 | sh -c \'"sleep 2; exec > /dev/null 2>&1; sleep 3; exit $s"\' |
| 18 | r=$? |
| 19 | if [ $r -ne $s ]; then |
| 20 | fail "exit code (with sleep) mismatch for: $r != $s" |
| 21 | fi |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 22 | done |