Peter Stephenson
8f5fe841a6
51652: fix running of TRAPEXIT explicitly.
...
This is a special case where TRAPEXIT is unset within a TRAPEXIT
as it should never run in a nested context, so just save the
function structure temporarily on the heap.
2023-04-17 09:30:34 +01:00
Philippe Altherr
f253ea6b9d
51076: fix ERR_EXIT when used with "eval" or "source"; documentary comments
2022-12-03 21:14:26 -08:00
Philippe Altherr
259f1e944b
51071: fix ERR_RETURN for functions in conditional statements
2022-12-03 21:03:36 -08:00
Philippe Altherr
dd3ba3d599
51001: fix for ERR_EXIT following shell function; update tests
2022-12-03 20:44:10 -08:00
Philippe Altherr
d47b8480f0
51001: fix for ERR_EXIT with pipeline negation ("!"); update tests
2022-12-03 20:42:13 -08:00
Philippe Altherr
fda6fd9513
51001: fix for ERR_EXIT with "always" blocks; update tests
2022-12-03 20:35:58 -08:00
Philippe Altherr
23dc19f005
51001: Reverts 8839e969b
, most of 1ba8714a
, and d873ed60
.
...
Also correct ChangeLog
2022-12-03 20:31:42 -08:00
Bart Schaefer
1ba8714a7a
50928: fix tests for 50897, mention behavior change in NEWS
2022-11-09 21:37:56 -08:00
Bart Schaefer
af634c3acd
unposted (see 50072): check exit status in exit-from-trap test
2022-04-17 19:19:05 -07:00
Bart Schaefer
f5c2f73301
50069: ChangeLog and test description for 50068
2022-04-14 16:39:34 -07:00
Bart Schaefer
d24d7242fe
50068: 'exit' in trap causes calling function to return
2022-04-14 16:31:50 -07:00
Peter Stephenson
e01223a26c
45373: Fix ERR_EXIT bug in else branch of if.
...
The flags need resetting for this branch otherwise e.g. command
substitution with non-zero status doesn't cause exit.
2020-02-02 18:05:47 +00:00
Daniel Shahaf
9432d9b1cf
45169/0002 (tweaked for trailing newlines): Add an expected-to-fail test for workers/44007.
2020-01-01 13:55:39 +00:00
Peter Stephenson
f19266cf99
unposted: another couple of tests for previous commit.
...
This tests different code paths as the -c command option exits
in a different fashion from code executed from a script.
2018-10-10 12:11:27 +01:00
Peter Stephenson
0d3a786b7c
43669: ensure explicit exit status is used over implicit
2018-10-10 11:17:58 +01:00
Peter Stephenson
bbccbe0c85
43660: extend 43653 when final exit is implicit.
...
Combine logic for case after committed to exit (shell_exiting) with
case where exit occurred in a function we nee to unwind (exit_pending).
Add sarky note for future generations to be confused at.
2018-10-09 14:38:26 +01:00
Peter Stephenson
afee3c9a19
unposted: addition to previous trap test suggested by Mikael
2018-10-09 11:15:48 +01:00
Peter Stephenson
d768a7492a
43653: explicit exit from EXIT trap overrides exit status
2018-10-09 10:05:05 +01:00
Peter Stephenson
17178db1a4
users/23531: Error exit/return fixes.
...
Fix regression with trap on left hand side of pipe.
Fix forced return from shell structure within nested function.
Fix tests exiting too early.
Add new test case.
2018-07-09 11:07:53 +01:00
Peter Stephenson
ebcea98eca
Fix problem with ERR_RETURN.
...
It wasn't suppressed properly in the code following an if
in some circumstances, in particular in initialsation scripts
and also in a nested function where the caller had suppressed
it.
2017-08-31 16:54:19 +01:00
Peter Stephenson
7d1877da4e
41608 (plus tests): restore ERR_EXIT before function.
...
There was an exception to the usual ERR_EXIT pattern that causes
problems when executing a function in an else branch. It seems
the exception is no longer needed as the regression tests pass
without it.
2017-08-29 19:52:18 +01:00
Peter Stephenson
d7110d8f01
41012: Fix premature exit from nested function in EXIT trap.
...
Also add check so we don't delay an exit if we were already in
an EXIT trap for the main shell, as we should in that case leave
immediately.
2017-04-27 18:56:18 +01:00
Peter Stephenson
9649ef5888
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.
2016-12-05 13:49:45 +00:00
Peter Stephenson
0e4aa6f2f6
Additional case for ERR_RETURN and ERR_EXIT.
...
Don't trigger just because status is non-zero at end of
current shell group.
2016-12-05 12:29:23 +00:00
Peter Stephenson
c03228f9ed
Extra case for ERR_RETURN and ERR_EXIT.
...
Don't trigger just because status is non-zero at end of
complex shell construct as this may be a case we've already
suppressed.
2016-12-05 11:21:01 +00:00
Peter Stephenson
5f1700755f
39901: No EXIT trap on LHS of pipeline.
...
There is a special case if the LHS is a shell construct.
Add unit tests for both cases.
2016-11-10 10:37:27 +00:00
Peter Stephenson
a57977d01a
39870: ensure exit trap can always run
2016-11-08 13:02:57 +00:00
Peter Stephenson
ffa6c76253
39578: Test more ERR_RETURN cases with "&&" and functions
2016-10-06 09:48:48 +01:00
Peter Stephenson
bcb52460f3
39571: Fix ERR_EXIT bug with && and function.
...
"foo && bar" inside a function could cause the code outside
the function not to perform ERR_EXIT or ERR_RETURN when needed.
2016-10-05 17:46:42 +01:00
Peter Stephenson
0854ee56bc
39568: "! <complex-command>" suppresses ERR_EXIT
2016-10-05 13:52:31 +01:00
Peter Stephenson
6b2585147b
39540: "! command" should suppress ERR_EXIT and ERR_RETURN
2016-10-02 19:17:19 +01:00
Peter Stephenson
17fb014dc7
38094: Fix POSIX EXIT traps defined in function.
...
These aren't local, so set the local level to 0; else they can get
overridden incorrectly.
2016-03-07 09:42:21 +00:00
Peter Stephenson
c55d855171
38024: Improve POSIX and native EXIT traps compatibility.
...
Allow a nested function trap to leave save and restore a POSIX
trap.
Still fails if the POSIX trap was defined in a function.
2016-02-25 14:20:26 +00:00
Peter Stephenson
ab74c86edb
37999: Sticky behaviour of EXIT traps.
...
They now have POSIX or non-POSIX behaviour based on the setting
of POSIX_TRAPS where the trap was defined, rather than where the
trap would (or would not) be executed.
Tweaks possible.
2016-02-17 10:40:55 +00:00
Barton E. Schaefer
cb26e11c70
unposted: back out 36707, add test case for 36766
2015-10-03 22:11:09 -07:00
Mikael Magnusson
ce12868837
unposted: add tests for outputting traps specified via aliases
2015-08-09 21:53:05 +02:00
Peter Stephenson
3af55c858f
35751: Fix ERR_RETURN and ERR_EXIT in "else"
2015-07-09 14:59:20 +01:00
Peter Stephenson
1869eeb393
30876: fix obscure failures to propagate non-zero status
...
from optimised simple commands within lists
2012-12-13 10:36:59 +00:00
Peter Stephenson
ade705cf5b
28253: document -h argument to atribute commands
2010-09-12 18:56:40 +00:00
Peter Stephenson
cb8ddf171e
c.f. 27950: strip bogus whitespace from tests
2010-05-10 12:31:49 +00:00
Peter Stephenson
a6ea7ab36d
27947: some cases where we should execute EXIT traps
2010-05-05 09:49:39 +00:00
Peter Stephenson
2e3363ef7d
25571: when parsing use line numbers for the start of a token, not the end
...
add test and move debug trap tests to new file
2008-08-31 19:50:47 +00:00
Peter Stephenson
b41c26d78a
25570: line numbers of complex sublists were wrong, plus test
...
make lineno zlong in another place
2008-08-31 16:01:10 +00:00
Peter Stephenson
b8ae885ab8
25532: problem skipping assignments etc. with setopt ERREXIT
2008-08-25 17:28:13 +00:00
Peter Stephenson
2706eac454
25415: Make DEBUG_BEFORE_CMD the default.
...
Reuse ERR_EXIT in DEBUG traps.
Clean up trapreturn code.
2008-08-07 16:25:14 +00:00
Peter Stephenson
b36d4eec0b
25400: Rockys test for second part of trapreturn bug
2008-08-06 08:54:18 +00:00
Peter Stephenson
21d757f50f
25392: test for 25367
2008-08-05 08:41:22 +00:00
Peter Stephenson
52e5a75a7a
23486: use {fd} syntax to get fd's for tests
2007-05-29 14:50:28 +00:00
Peter Stephenson
b4a7ad8269
23101: various combinations of ZERR with function returns were feature-ridden
2007-01-12 23:10:15 +00:00
Peter Stephenson
862c974d7c
22277: missed bit
2006-03-03 22:09:58 +00:00