diff options
author | Denys Vlasenko | 2010-05-20 14:27:09 +0200 |
---|---|---|
committer | Denys Vlasenko | 2010-05-20 14:27:09 +0200 |
commit | cddbb610cb0ea8d74668653aeaded710d2d13768 (patch) | |
tree | fea97f7c4fd0871543502d2fcefc189ee5d68288 /shell/hush_test | |
parent | 131ed3bcc9c9eabcb4bd6a063c24c6f9922f1491 (diff) | |
download | busybox-cddbb610cb0ea8d74668653aeaded710d2d13768.zip busybox-cddbb610cb0ea8d74668653aeaded710d2d13768.tar.gz |
hush: fix var=`exit 2` not setting $? to 2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush_test')
-rw-r--r-- | shell/hush_test/hush-psubst/falsetick.right | 27 | ||||
-rwxr-xr-x | shell/hush_test/hush-psubst/falsetick.tests | 22 |
2 files changed, 49 insertions, 0 deletions
diff --git a/shell/hush_test/hush-psubst/falsetick.right b/shell/hush_test/hush-psubst/falsetick.right new file mode 100644 index 0000000..0b98fb7 --- /dev/null +++ b/shell/hush_test/hush-psubst/falsetick.right @@ -0,0 +1,27 @@ +0 +0 +0 +0 +2 +2 +2 +2 +hush: can't open '/does/not/exist': No such file or directory +1 +hush: can't open '/does/not/exist': No such file or directory +1 +hush: can't open '/does/not/exist': No such file or directory +1 +hush: can't open '/does/not/exist': No such file or directory +1 +hush: can't open '/does/not/exist': No such file or directory +1 +hush: can't open '/does/not/exist': No such file or directory +1 +hush: can't open '/does/not/exist': No such file or directory +1 +hush: can't open '/does/not/exist': No such file or directory +1 +hush: can't open '/does/not/exist': No such file or directory +1 +Done: a=b diff --git a/shell/hush_test/hush-psubst/falsetick.tests b/shell/hush_test/hush-psubst/falsetick.tests new file mode 100755 index 0000000..44d2eae --- /dev/null +++ b/shell/hush_test/hush-psubst/falsetick.tests @@ -0,0 +1,22 @@ +# Exitcode 0 (`` has no exitcode, but assignment has): +true; a=``; echo $? +false; a=``; echo $? +true; a=$(); echo $? +false; a=$(); echo $? +# Exitcode 2 (`cmd` expansion sets exitcode after assignment set it to 0): +true; a=`exit 2`; echo $? +false; a=`exit 2`; echo $? +true; a=$(exit 2); echo $? +false; a=$(exit 2); echo $? +# Exitcode 1 (redirect sets exitcode to 1 on error after them): +true; a=`` >/does/not/exist; echo $? +false; a=`` >/does/not/exist; echo $? +true; a=$() >/does/not/exist; echo $? +false; a=$() >/does/not/exist; echo $? +true; a=`exit 2` >/does/not/exist; echo $? +false; a=`exit 2` >/does/not/exist; echo $? +true; a=$(exit 2) >/does/not/exist; echo $? +false; a=$(exit 2) >/does/not/exist; echo $? +# ...and assignment still happens despite redirect error: +true; a=$(echo b) >/does/not/exist; echo $? +echo "Done: a=$a" |