about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2022-12-12 10:27:29 +0000
committerPeter Stephenson <p.stephenson@samsung.com>2022-12-12 10:27:29 +0000
commit14559421e2a054f9b09d6fa1971158a5e7e162a6 (patch)
tree996941967365c95cb8f60fe10fb7430fdeaf4501
parent2028539cb168d652dfa77e5b85b382c319b3a99a (diff)
downloadzsh-14559421e2a054f9b09d6fa1971158a5e7e162a6.tar.gz
zsh-14559421e2a054f9b09d6fa1971158a5e7e162a6.tar.xz
zsh-14559421e2a054f9b09d6fa1971158a5e7e162a6.zip
51134: document interactive behaviour with ERR_EXIT and ERR_RETURN
-rw-r--r--ChangeLog5
-rw-r--r--Doc/Zsh/options.yo8
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 0a2a880f4..d8672c028 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-12-12  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 51134: Doc/Zsh/options.yo: document interactions between
+	ERR_EXIT and ERR_RETURN and interactive shells.
+
 2022-12-09  Bart Schaefer  <schaefer@zsh.org>
 
 	* 51161: Src/exec.c: correct errno after closing xtrace FD
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 445052617..e92969531 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -1744,6 +1744,9 @@ Exiting due to tt(ERR_EXIT) has certain interactions with asynchronous
 jobs noted in
 ifzman(the section JOBS in zmanref(zshmisc))\
 ifnzman(noderef(Jobs & Signals)).
+
+Note this behaviour is not disabled in interactive shells ---
+a non-zero status on the command line causes the shell to exit.
 )
 pindex(ERR_RETURN)
 pindex(NO_ERR_RETURN)
@@ -1756,7 +1759,10 @@ If a command has a non-zero exit status, return immediately from the
 enclosing function.  The logic is similar to that for tt(ERR_EXIT),
 except that an implicit tt(return) statement is executed instead of an
 tt(exit).  This will trigger an exit at the outermost level of a
-non-interactive script.
+non-interactive script.  At the top level of an interactive shell,
+it will trigger a return to the command prompt; in other
+words, the sequence of commands typed by the user may be
+thought of as a function for this purpose.
 
 Normally this option inherits the behaviour of tt(ERR_EXIT) that
 code followed by `tt(&&)' `tt(||)' does not trigger a return.  Hence