mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-01 05:16:05 +01:00
40100: ERR_EXIT and ERR_RETURN test for anonymous functions.
Should trigger on non-zero status at end of function even if behaviour is suppressed by code inside the function at the point the status is set.
This commit is contained in:
parent
0e4aa6f2f6
commit
9649ef5888
2 changed files with 15 additions and 0 deletions
|
@ -1,5 +1,9 @@
|
||||||
2016-12-05 Peter Stephenson <p.stephenson@samsung.com>
|
2016-12-05 Peter Stephenson <p.stephenson@samsung.com>
|
||||||
|
|
||||||
|
* 40100: Test/C03traps.ztst: Check ERR_EXIT and ERR_RETURN on
|
||||||
|
anonymous functions: should exit on function return even if
|
||||||
|
suppressed internally.
|
||||||
|
|
||||||
* 40097: Src/exec.c, Test/C03traps.ztst: Don't trigger ERR_EXIT
|
* 40097: Src/exec.c, Test/C03traps.ztst: Don't trigger ERR_EXIT
|
||||||
or ERR_RETURN on non-zero status after current shell group, either.
|
or ERR_RETURN on non-zero status after current shell group, either.
|
||||||
|
|
||||||
|
|
|
@ -713,6 +713,17 @@ F:Must be tested with a top-level script rather than source or function
|
||||||
)
|
)
|
||||||
1:ERR_EXIT triggered by status 1 within { }
|
1:ERR_EXIT triggered by status 1 within { }
|
||||||
|
|
||||||
|
(setopt err_exit
|
||||||
|
() {
|
||||||
|
false && true
|
||||||
|
print Still functioning
|
||||||
|
false && true
|
||||||
|
}
|
||||||
|
print OK
|
||||||
|
)
|
||||||
|
1:ERR_EXIT triggered by status 1 at end of anon func
|
||||||
|
>Still functioning
|
||||||
|
|
||||||
if zmodload zsh/system 2>/dev/null; then
|
if zmodload zsh/system 2>/dev/null; then
|
||||||
(
|
(
|
||||||
trap 'echo TERM; exit 2' TERM
|
trap 'echo TERM; exit 2' TERM
|
||||||
|
|
Loading…
Reference in a new issue