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

Re: bug in zsh wait builtin - rhbz#1150541

On Oct 25,  8:08pm, Peter Stephenson wrote:
} Here's an implementation.  I've given it the obvious finger test, but
} there may be some more stressful tests we could apply.  Note I'm only
} recording background PIDs, since the user can't explicitly wait for
} foreground PIDs; it's possible I've missed a case where something can
} be in the background but that would suggest the job is wrongly recorded.

I was going to ask a bunch of questions about this but in looking at the
patch I realized that you determine foreground-ness at the time the job
exits, not at the time it's started, so this sounds fine.

Incidentally, when you ^Z the foreground job, the value of $! is not
updated, so the only way to use wait is by job identifier (which is
equivalent to using fg).  $! finally does get updated when the job is
continued with bg.  (This describes the pre-33531-patch state, but I
don't think the patch alters it.)

} One piece of unfinished business: I think lastpid_status can go, but
} the logic associated with it is rather different from what I just
} implemented so I'd like some further thoughts

I can't think of a case where lastpid_status would not be the same as
getbgstatus(lastpid) ... I suppose you could throw in a DPUTS() to
confirm that, just as a sanity check, but otherwise I concur that you
can do away with lastpid_status.

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