1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-06-07 07:46:04 +02:00

51001: fix for ERR_EXIT with "always" blocks; update tests

This commit is contained in:
Philippe Altherr 2022-12-03 20:35:58 -08:00 committed by Bart Schaefer
parent 23dc19f005
commit fda6fd9513
2 changed files with 33 additions and 10 deletions

View File

@ -793,6 +793,7 @@ exectry(Estate state, int do_exec)
cmdpop();
popheap();
state->pc = end;
this_noerrexit = 1;
return endval;
}

View File

@ -720,6 +720,13 @@ F:Must be tested with a top-level script rather than source or function
0:ERR_RETURN in "else" branch in nested function
>Good
(setopt err_exit
false && true
print OK
)
0:ERR_EXIT not triggered by "false && true"
>OK
(setopt err_exit
for x in y; do
false && true
@ -727,16 +734,6 @@ F:Must be tested with a top-level script rather than source or function
print OK
)
0:ERR_EXIT not triggered by status 1 at end of for
>OK
(setopt err_exit
integer x=0
while (( ! x++ )); do
false && true
done
print OK
)
0:ERR_EXIT not triggered by status 1 at end of while
>OK
(setopt err_exit
@ -755,6 +752,31 @@ F:Must be tested with a top-level script rather than source or function
print OK
)
0:ERR_EXIT not triggered by status 1 at end of if
>OK
(setopt err_exit
loop=true
while print COND; $loop; do
loop=false
false && true
done
print OK
)
0:ERR_EXIT not triggered by status 1 at end of while
>COND
>COND
>OK
(setopt err_exit
{
false && true
} always {
print ALWAYS
}
print OK
)
0:ERR_EXIT not triggered by status 1 at end of always
>ALWAYS
>OK
(setopt err_exit