Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [Bug] Exiting shell from function called by trap handler always produces status 0
- X-seq: zsh-workers 43666
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: <zsh-workers@xxxxxxx>
- Subject: Re: [Bug] Exiting shell from function called by trap handler always produces status 0
- Date: Tue, 9 Oct 2018 21:09:12 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com; s=meg.feb2017; t=1539115754; bh=PzKrfnOjBdhZ0IlFc+N/rmFy/Vts3kJR9ZVGBWWXXco=; h=Date:From:To:Subject:In-Reply-To:References; b=F9KAEZ6DoqAw4P+z/ImNmtulEgtSvM2NeKDMlCXGKRbzNNYc1U6S7MRHd3v2qD9G9 ELoKTBtUxC5EJG93OkIU+b4+Denw0UtwEjCnss5uWrNMw/ASjuFeS3+F3Xrh/ovRed 3IdbQhU1soQygLZVU8VVKPN2f7hvFaxPy8XP5qVT3c/8xOA4AV84PAfp+DAqZH7Ego BoVNEn5bN4JnP5tyaFyYxq7Sc9aLHxiOfzmpiKDPTUkVIeXJ79X+rsDcI9LXyGJg2C uEZOD5sxsbNwibPap2qUl1u/3Iu5p/oF9+RhbUXbRmqTJrQFzh6U4hiwojPxEzUGDz qbdbCTqHTsCrQ==
- In-reply-to: <20181009131646eucas1p2eb07d8fa34e97de25db60d6a56c584a4~b8x2n0O1S2407324073eucas1p2z@eucas1p2.samsung.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CGME20181009012624epcas1p44f2ae223f663713a980af4be735e5a3f@epcas1p4.samsung.com> <a5934536-7982-c434-d98d-2c07d66b0739@inlv.org> <20181009084918eucas1p27dedda10d51beb773ba9175967912d2c~b5IUtvcVK3037630376eucas1p2R@eucas1p2.samsung.com> <205ea5e4-4dc9-2ebf-9437-0822195e1a9a@inlv.org> <20181009131646eucas1p2eb07d8fa34e97de25db60d6a56c584a4~b8x2n0O1S2407324073eucas1p2z@eucas1p2.samsung.com>
Here's a slight improvement --- we can "exit 0" even if the last command
status is non-zero.
pws
diff --git a/Src/builtin.c b/Src/builtin.c
index e01e035cc..8dcdcc024 100644
--- a/Src/builtin.c
+++ b/Src/builtin.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. *
Messages sorted by:
Reverse Date,
Date,
Thread,
Author