zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@zsh.org
Subject: Re: unable to wait on completed job [was: should $! give the pid of subshell?]
Date: Wed, 2 Dec 2009 09:53:33 +0000	[thread overview]
Message-ID: <20091202095333.77e37678@news01> (raw)
In-Reply-To: <200912010952.nB19qs51012135@news01.csr.com>

On Tue, 01 Dec 2009 09:52:54 +0000
Peter Stephenson <pws@csr.com> wrote:
> Bart Schaefer wrote:
> > On Nov 30,  6:37pm, Peter Stephenson wrote:
> > }
> > } If it's only an issue for $! (lastpid internally), I think it's fairly
> > } straightforward to fix. I tried to make it work even if a new process
> > } with the same PID came along later.
> > 
> > This looks reasonable, but I wonder if we should make it conditional
> > on POSIX_JOBS ?
> 
> I'm not sure what that gains, apart from an extra error message; is
> there a case where it's important that exited background jobs can't be
> waited for?

I don't know either.  I've committed it checking for POSIXJOBS only in
wait, so you can set that just for the wait command and it will work.  We
probably need some documentation.

There's a race here if process numbers are being used up megafast, but it's
unlikely enough I haven't bothered mentioning it.

Index: Doc/Zsh/options.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v
retrieving revision 1.86
diff -u -r1.86 options.yo
--- Doc/Zsh/options.yo	21 Jul 2009 09:35:20 -0000	1.86
+++ Doc/Zsh/options.yo	2 Dec 2009 09:51:56 -0000
@@ -1324,6 +1324,11 @@
 shell is saved for output within a subshell (for example, within a
 pipeline).  When the option is set, the output of tt(jobs) is empty
 until a job is started within the subshell.
+
+When the option is set, it becomes possible to use the tt(wait) builtin to
+wait for the last job started in the background (as given by tt($!)) even
+if that job has already exited.  This works even if the option is turned
+on temporarily around the use of the tt(wait) builtin.
 )
 enditem()
 

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


      reply	other threads:[~2009-12-02  9:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <19213.26295.345572.732238@gargle.gargle.HOWL>
     [not found] ` <200911251748.nAPHmrCX010198@news01.csr.com>
     [not found]   ` <m3638sr72x.fsf_-_@klanderman.net>
     [not found]     ` <091129211436.ZM1769@torch.brasslantern.com>
2009-11-30 18:37       ` Peter Stephenson
2009-12-01  2:57         ` Bart Schaefer
2009-12-01  9:52           ` Peter Stephenson
2009-12-02  9:53             ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091202095333.77e37678@news01 \
    --to=pws@csr.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).