Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Wait test failure
On Mon, 10 Aug 2015 16:18:17 +0100
Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
>
> I'm wondering if in
>
> (exit 1) &
> one=$!
> (exit 2) &
> two=$!
>
> when we handle the first background process, sometimes the second has
> already exited so we use the status from that instead? That would be
> quite serious --- and quite possibly not a new effect, just exacerbated
> by additional signal blocking.
Hmm...
Never second guess a quantity you can calculate explicitly.
Ismail, does this fix your occurrence of the problem, too?
diff --git a/Src/signals.c b/Src/signals.c
index 697c4c5..78dc75b 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -528,8 +528,14 @@ wait_for_processes(void)
* and is not equal to the current foreground job.
*/
if (jn && !(jn->stat & (STAT_CURSH|STAT_BUILTIN)) &&
- jn - jobtab != thisjob)
- addbgstatus(pid, (int)lastval2);
+ jn - jobtab != thisjob) {
+ int val = (WIFSIGNALED(status) ?
+ 0200 | WTERMSIG(status) :
+ (WIFSTOPPED(status) ?
+ 0200 | WEXITSTATUS(status) :
+ WEXITSTATUS(status)));
+ addbgstatus(pid, val);
+ }
}
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author