1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-26 18:01:03 +02:00

45110: zshmisc(1): Fix markup of "try-list" and "always-list".

This commit is contained in:
Daniel Shahaf 2019-12-21 12:41:04 +00:00
parent a0c0aa41d2
commit f7f2baac5e
2 changed files with 15 additions and 12 deletions

View file

@ -1,5 +1,8 @@
2019-12-22 Daniel Shahaf <danielsh@apache.org> 2019-12-22 Daniel Shahaf <danielsh@apache.org>
* 45110: Doc/Zsh/grammar.yo: zshmisc(1): Fix markup of "try-list"
and "always-list".
* 45111: Doc/Zsh/grammar.yo, Etc/BUGS, NEWS, * 45111: Doc/Zsh/grammar.yo, Etc/BUGS, NEWS,
Test/A01grammar.ztst: zshmisc(1): Clarify the documentation of Test/A01grammar.ztst: zshmisc(1): Clarify the documentation of
'return' and 'exit' in conjunction with try/always 'return' and 'exit' in conjunction with try/always

View file

@ -313,23 +313,23 @@ An `error' in this context is a condition such as a syntax error which
causes the shell to abort execution of the current function, script, or causes the shell to abort execution of the current function, script, or
list. Syntax errors encountered while the shell is parsing the list. Syntax errors encountered while the shell is parsing the
code do not cause the var(always-list) to be executed. For example, code do not cause the var(always-list) to be executed. For example,
an erroneously constructed tt(if) block in tt(try-list) would cause the an erroneously constructed tt(if) block in var(try-list) would cause the
shell to abort during parsing, so that tt(always-list) would not be shell to abort during parsing, so that var(always-list) would not be
executed, while an erroneous substitution such as tt(${*foo*}) would executed, while an erroneous substitution such as tt(${*foo*}) would
cause a run-time error, after which tt(always-list) would be executed. cause a run-time error, after which var(always-list) would be executed.
An error condition can be tested and reset with the special integer An error condition can be tested and reset with the special integer
variable tt(TRY_BLOCK_ERROR). Outside an tt(always-list) the value is variable tt(TRY_BLOCK_ERROR). Outside an var(always-list) the value is
irrelevant, but it is initialised to tt(-1). Inside tt(always-list), the irrelevant, but it is initialised to tt(-1). Inside var(always-list), the
value is 1 if an error occurred in the tt(try-list), else 0. If value is 1 if an error occurred in the var(try-list), else 0. If
tt(TRY_BLOCK_ERROR) is set to 0 during the tt(always-list), the error tt(TRY_BLOCK_ERROR) is set to 0 during the var(always-list), the error
condition caused by the tt(try-list) is reset, and shell execution condition caused by the var(try-list) is reset, and shell execution
continues normally after the end of tt(always-list). Altering the value continues normally after the end of var(always-list). Altering the value
during the tt(try-list) is not useful (unless this forms part of an during the var(try-list) is not useful (unless this forms part of an
enclosing tt(always) block). enclosing tt(always) block).
Regardless of tt(TRY_BLOCK_ERROR), after the end of tt(always-list) the Regardless of tt(TRY_BLOCK_ERROR), after the end of var(always-list) the
normal shell status tt($?) is the value returned from tt(try-list). normal shell status tt($?) is the value returned from var(try-list).
This will be non-zero if there was an error, even if tt(TRY_BLOCK_ERROR) This will be non-zero if there was an error, even if tt(TRY_BLOCK_ERROR)
was set to zero. was set to zero.