zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-users@zsh.org
Subject: Re: process substitution bug with set -e?
Date: Wed, 16 Oct 2013 18:53:51 +0100	[thread overview]
Message-ID: <20131016185351.7dfa7d7e@pws-pc.ntlworld.com> (raw)
In-Reply-To: <131015072947.ZM1984@torch.brasslantern.com>

On Tue, 15 Oct 2013 07:29:47 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> I think we should be able to say something more general about the behavior
> of "exit" with respect to asynchronous jobs, and that ERR_EXIT has the
> same behavior.  There's a little about this in the "Jobs" section but it
> only references explicitly backgrounded jobs and the HUP signal/option,
> not about implicitly asynchronous jobs.
> 
> For example, note that multios and process substitutions are "disowned"
> in the sense that they don't get HUP'd (they also don't get TTOU'd, but
> aren't able to read from the terminal as far as I can tell [I/O error]).

Please provide any further patches that seem a good idea on top of this.

diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index 2cc33d2..1d9fe68 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -595,6 +595,11 @@ is specified, use the exit status from the last command executed.
 pindex(IGNORE_EOF, use of)
 An EOF condition will also cause the shell to exit, unless
 the tt(IGNORE_EOF) option is set.
+
+See notes at the end of
+ifzman(the section JOBS in in zmanref(zshmisc))\
+ifnzman(noderef(Jobs & Signals)) for some possibly unexpected interactions
+of the tt(exit) command with jobs.
 )
 findex(export)
 item(tt(export) [ var(name)[tt(=)var(value)] ... ])(
diff --git a/Doc/Zsh/jobs.yo b/Doc/Zsh/jobs.yo
index 3baf77f..d939501 100644
--- a/Doc/Zsh/jobs.yo
+++ b/Doc/Zsh/jobs.yo
@@ -115,3 +115,18 @@ The shell itself always ignores the tt(QUIT) signal.
 Otherwise, signals have the values
 inherited by the shell from its parent
 (but see the tt(TRAP)var(NAL) special functions in noderef(Functions)).
+
+cindex(exiting shell, and asynchronous jobs)
+cindex(asynchronous jobs, and exiting shell)
+cindex(jobs, asynchronous, and exiting shell)
+Certain jobs are run asynchronously by the shell other than those
+explicitly put into the background; even in cases where the shell
+would usually wait for such jobs, an explicit tt(exit) command
+or exit due to the option tt(ERR_EXIT) will cause the shell to
+exit without waiting.  Examples of such asynchronous jobs are
+process substitution, see
+ifzman(the section PROCESS SUBSTITUTION in the zmanref(zshexpn) manual page)\
+ifnzman(noderef(Process Substitution)), and the handler processes for
+multios, see
+ifzman(the section MULTIOS in the zmanref(zshmisc) manual page)\
+ifnzman(the section Multios in noderef(Redirection)).
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 9055215..3c6ea63 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -1553,6 +1553,11 @@ the trap.  If the option tt(DEBUG_BEFORE_CMD) is set,
 as it is by default, and the option tt(ERR_EXIT) is found to have been set
 on exit, then the command for which the tt(DEBUG) trap is being executed is
 skipped.  The option is restored after the trap exits.
+
+Exiting due to tt(ERR_EXIT) has certain interactions with asynchronous
+jobs noted in
+ifzman(the section JOBS in in zmanref(zshmisc))\
+ifnzman(noderef(Jobs & Signals)).
 )
 pindex(ERR_RETURN)
 pindex(NO_ERR_RETURN)

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


      reply	other threads:[~2013-10-16 17:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-14 12:41 Vincent Lefevre
2013-10-14 13:48 ` Peter Stephenson
2013-10-14 15:08   ` Vincent Lefevre
2013-10-14 16:23     ` Bart Schaefer
2013-10-14 16:28     ` Peter Stephenson
2013-10-14 17:47       ` Bart Schaefer
2013-10-15  8:42         ` Peter Stephenson
2013-10-15 14:29           ` Bart Schaefer
2013-10-16 17: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=20131016185351.7dfa7d7e@pws-pc.ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-users@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).