Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Exit code 130 kills pipeline
- X-seq: zsh-workers 46069
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Exit code 130 kills pipeline
- Date: Thu, 18 Jun 2020 11:49:32 +0100 (BST)
- Importance: Medium
- In-reply-to: <CAN=4vMrp+foMSuq_ZP92U1wA-=RMa59Q-51muxSECEhC1gR24Q@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAN=4vMqH7hQ6p=x+WHcWe3Xr2wD26W1kv65dUj4M5SmgsGo7Qw@mail.gmail.com> <1742415134.186024.1592413109794@mail2.virginmedia.com> <CAN=4vMrp+foMSuq_ZP92U1wA-=RMa59Q-51muxSECEhC1gR24Q@mail.gmail.com>
Not a direct part of this bug, but while I'm looking I might at least
mention it, though I suspect it's very minor in practice.
Just looking at the code that sets the return value:
/* last job in pipeline determines exit status */
val = (WIFSIGNALED(pn->status) ?
0200 | WTERMSIG(pn->status) :
(WIFSTOPPED(pn->status) ?
0200 | WEXITSTATUS(pn->status) :
WEXITSTATUS(pn->status)));
signalled = WIFSIGNALED(pn->status);
The only case where the bottom bits are the signal is WIFSIGNALED();
that's the fix that's just gone in, so no problem with that one.
However, I notice the Linux manual page says WEXITSTATUS() is only
useful if WIFEXITED() is true for the status. So the remaining
two cases could possibly do with a bit of surgery. I'm guessing
WIFSTOPPED() usually reports a status of 128 + 0, and if the
process is stopped (not exited) I'm not sure if the user gets
to see the status anyway. So this may be a non-issue.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author