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

Re: use of "less" in function and interrupt

On Jul 20,  8:40pm, Bart Schaefer wrote:
} Probably there's some point where the one last wait is needed, within
} the cleanup of jobs in the current shell, to make sure that all the
} subjobs really did go away.  I suspect this to be related to the
} breakup of errflag into ERRFLAG_ERROR and ERRFLAG_INT.

Indeed the following seems to fix it.  All tests still pass and the
several interactive cases I tried appear to do the right thing, but
I'm not sure there isn't some edge case I've missed.  For example,
perhaps we should be saving and restoring errflag around the call
to signal_suspend() so that it can't be cleared by trap handlers?

I call attention to the comments from Oberon and PWS just a few lines
below the context of this diff.

diff --git a/Src/jobs.c b/Src/jobs.c
index 3db2ed0..ce8535d 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -1472,7 +1472,7 @@ zwaitjob(int job, int wait_cmd)
 	    pipecleanfilelist(jn->filelist, 0);
-	while (!errflag && jn->stat &&
+	while (!(errflag & ERRFLAG_ERROR) && jn->stat &&
 	       !(jn->stat & STAT_DONE) &&
 	       !(interact && (jn->stat & STAT_STOPPED))) {
 	    signal_suspend(SIGCHLD, wait_cmd);

Messages sorted by: Reverse Date, Date, Thread, Author