Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The exit status of command terminated with a signal in the pipeline seems be wrong #742

Open
ko1nksm opened this issue Apr 5, 2024 · 0 comments

Comments

@ko1nksm
Copy link

ko1nksm commented Apr 5, 2024

The seq command seems to terminate with 256+signum (unlike 128+signum in other shells) as expected, but the shell does not seem to get the values right. Perhaps it has something to do with the exit status value obtained from the subshell, but I don't know what is right.

ksh93u+m/1.1.0-alpha+8f84f4b2

$ ksh -c 'set -o pipefail; (seq 1000000; xs=$?; echo $xs >&2; exit $xs) | head > /dev/null; echo $?'
269
13

$ ksh -c '(exit 255); echo $?; (exit 256); echo $?; (exit 257); echo $?'
255
0
1

$ ksh -c 'set -o pipefail; (exit 255)|:; echo $?; (exit 256)|:; echo $?; (exit 257)|:; echo $?'
255
0
1

ksh93u+

$ ksh -c 'set -o pipefail; (seq 1000000; xs=$?; echo $xs >&2; exit $xs) | head > /dev/null; echo $?'
269
141

$ ksh -c '(exit 255); echo $?; (exit 256); echo $?; (exit 257); echo $?'
255
0
257

$ ksh -c 'set -o pipefail; (exit 255)|:; echo $?; (exit 256)|:; echo $?; (exit 257)|:; echo $?'
255
0
129
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant