Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Exit code 130 kills pipeline



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