zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: Shell job structure
Date: Fri, 25 Oct 2013 10:04:45 -0700	[thread overview]
Message-ID: <131025100445.ZM9154@torch.brasslantern.com> (raw)
In-Reply-To: <20131025162146.459b92c2@pwslap01u.europe.root.pri>

On Oct 25,  4:21pm, Peter Stephenson wrote:
}
} > % false | true | false | while true | false | true; do print $pipestatus; break; done; print $pipestatus
} > 0 1 0
} > 1 0 1 0
} 
} That's the sort of thing I'm worrying about.  As long as it can identify
} succesfully which job it needs to worry about at any time, it should be
} OK.

Every entry in $pipestatus except the very last one is copied from a
"Process" structure in the Job "procs" list, so as long as child reaping
updates the correct Process (which seems to be pretty solid or we'd have
scads of other problems) there's only that last slot to worry about.

The global "lastval" is used to populate that final slot when the command
is executing in the current shell.  That's a bit fragile and somewhat
backward because in all other cases the status that goes into pipestats
is also used to *assign* lastval -- it's just this "optimized" case where
we assume lastval has already been set correctly.

This is why update_job() has to skip PIPEFAIL handling and leave that to 
printjob(), so they don't use lastval in the wrong order.


      reply	other threads:[~2013-10-25 17:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CADv1Z=pM7H4Xg9+GyWd4zw0cv0mXfbJvqip6vc7e_yrXRN=1sg@mail.gmail.com>
     [not found] ` <20131005223159.25fea6a0@pws-pc.ntlworld.com>
2013-10-07  0:36   ` No pipefail option? Bart Schaefer
2013-10-07  9:25     ` Peter Stephenson
2013-10-07 14:40       ` Bart Schaefer
2013-10-08 20:44         ` Shell job structure Peter Stephenson
2013-10-25  5:02           ` Bart Schaefer
2013-10-25 10:00             ` Peter Stephenson
2013-10-25 15:13               ` Bart Schaefer
2013-10-25 15:21                 ` Peter Stephenson
2013-10-25 17:04                   ` Bart Schaefer [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=131025100445.ZM9154@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).