mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-09-28 15:01:21 +02:00
43669: ensure explicit exit status is used over implicit
This commit is contained in:
parent
46c448cf9b
commit
0d3a786b7c
@ -1,3 +1,8 @@
|
||||
2018-10-10 Peter Stephenson <p.stephenson@samsung.com>
|
||||
|
||||
* 43669: Src/builtin.c, Src/init.c, Test/C03traps.ztst: ensure
|
||||
explicit exit status is used rather than implicit.
|
||||
|
||||
2018-10-09 Peter Stephenson <p.stephenson@samsung.com>
|
||||
|
||||
* 43660: Src/builtin.c, Src/exec.c, Src/init.c,
|
||||
|
@ -5723,7 +5723,7 @@ int exit_val;
|
||||
void
|
||||
realexit(void)
|
||||
{
|
||||
exit(exit_val ? exit_val : lastval);
|
||||
exit((shell_exiting || exit_pending) ? exit_val : lastval);
|
||||
}
|
||||
|
||||
/* As realexit(), but call _exit instead */
|
||||
@ -5732,7 +5732,7 @@ realexit(void)
|
||||
void
|
||||
_realexit(void)
|
||||
{
|
||||
_exit(exit_val ? exit_val : lastval);
|
||||
_exit((shell_exiting || exit_pending) ? exit_val : lastval);
|
||||
}
|
||||
|
||||
/* exit the shell. val is the return value of the shell. *
|
||||
|
@ -1358,7 +1358,7 @@ init_misc(char *cmd, char *zsh_name)
|
||||
bshin = fdopen(SHIN, "r");
|
||||
execstring(cmd, 0, 1, "cmdarg");
|
||||
stopmsg = 1;
|
||||
zexit(exit_val ? exit_val : lastval, 0);
|
||||
zexit((exit_pending || shell_exiting) ? exit_val : lastval, 0);
|
||||
}
|
||||
|
||||
if (interact && isset(RCS))
|
||||
|
@ -872,6 +872,9 @@ F:Must be tested with a top-level script rather than source or function
|
||||
$ZTST_testdir/../Src/zsh -fc 'fn() { exit 13; }; trap fn EXIT'
|
||||
13:Explicit exit in exit trap overrides implicit exit status
|
||||
|
||||
$ZTST_testdir/../Src/zsh -fc 'fn() { exit 0; }; trap fn EXIT; false'
|
||||
0:Explicit exit status 0 in exit trap overrides implicit non-zero status
|
||||
|
||||
%clean
|
||||
|
||||
rm -f TRAPEXIT
|
||||
|
Loading…
Reference in New Issue
Block a user