about summary refs log tree commit diff
path: root/t
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2023-08-01 18:49:26 +0200
committerLeah Neukirchen <leah@vuxu.org>2023-08-02 13:50:38 +0200
commitf350b6f16c668cd49dc24be3b6dd44c059fe2e0c (patch)
treebeb62542f4a90d688cd77a1512e605da7925d7cb /t
parent8a2a4899769335bc14c62aef12cdf26f2f487f2a (diff)
downloadxe-f350b6f16c668cd49dc24be3b6dd44c059fe2e0c.tar.gz
xe-f350b6f16c668cd49dc24be3b6dd44c059fe2e0c.tar.xz
xe-f350b6f16c668cd49dc24be3b6dd44c059fe2e0c.zip
properly forward errors on exec, return 123 on any exit status 1-254
Use the CLOEXEC pipe trick to detect if exec happened; read the errno
from the pipe if it wasn't closed due to exec.
Diffstat (limited to 't')
-rwxr-xr-xt/errors.t23
1 files changed, 22 insertions, 1 deletions
diff --git a/t/errors.t b/t/errors.t
index c2ecd5e..eb05dc0 100755
--- a/t/errors.t
+++ b/t/errors.t
@@ -1,7 +1,7 @@
 #!/bin/sh
 export "PATH=.:$PATH"
 
-printf '1..13\n'
+printf '1..16\n'
 printf '# error handling\n'
 
 tap3 'exit code on success' <<'EOF'
@@ -21,6 +21,27 @@ a
 >>>= 123
 EOF
 
+tap3 'exit code on when command fails with 126' <<'EOF'
+xe -s 'exit 126'
+<<<
+a
+>>>= 123
+EOF
+
+tap3 'exit code on when command fails with 127' <<'EOF'
+xe -s 'exit 127'
+<<<
+a
+>>>= 123
+EOF
+
+tap3 'exit code on when command fails with 250' <<'EOF'
+xe -s 'exit 250'
+<<<
+a
+>>>= 123
+EOF
+
 tap3 'exit code on when command fails with 255' <<'EOF'
 xe -s 'exit 255'
 <<<