Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] 'command' + special built-in exits shell on error
- X-seq: zsh-workers 37434
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [BUG] 'command' + special built-in exits shell on error
- Date: Fri, 25 Dec 2015 00:12:40 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=EeGiqwijUlA+mAd38DWiqPLansvxBYVUHKQ59dUkRjs=; b=prZ7M+9dia7R8TZGeFKgL04dfhgIxQSwW1VxoD1Wz49ptrnPSTaohEAoS+UBAw8NNJ 8mwRfs+4scraAnAHtXccTYw+zV6LYjjggeN2+ZqNqVPR0RMMR7RF1baE3JHlXiEz+7+a 5zf7gZ9xXZbcOZhHKvpFWtWxJtuqPnJImvIrUcFTuadatQaZ4iclfJmxAZrW3a0z1aAM OohqJgXJgd2juY7pqst8okg1OzDCPB0DorZggQ7OXWpmgF2b7OaXNARp6pVQfoFHo2WD 1FwAxV4hFPf6Z5WiO7Ti1E36i3pYAxgtW7kHLLlRonteGANhyhOMIbIKjNA9sxH8d+AH tXuA==
- In-reply-to: <567A8B32.9030300@inlv.org>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <567A8B32.9030300@inlv.org>
On Dec 23, 11:53am, Martijn Dekker wrote:
}
} My bug report is that zsh still exits even when 'command' is used, and
} even when emulating sh.
When not emulating sh, "command" can't be used in front of a special
builtin at all -- in zsh mode it always forces the command to be NOT
built-in, i.e., it's implicitly "command -p".
Consequently we only care about POSIXBUILTINS mode.
diff --git a/Src/exec.c b/Src/exec.c
index acc867c..f14fc27 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3475,10 +3475,10 @@ execcmd(Estate state, int input, int output, int how, int last1)
restore_queue_signals(q);
} else if (is_builtin || is_shfunc) {
LinkList restorelist = 0, removelist = 0;
+ int do_save = 0;
/* builtin or shell function */
- if (!forked && varspc) {
- int do_save = 0;
+ if (!forked) {
if (isset(POSIXBUILTINS)) {
/*
* If it's a function or special builtin --- save
@@ -3497,7 +3497,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
if ((cflags & BINF_COMMAND) || !assign)
do_save = 1;
}
- if (do_save)
+ if (do_save && varspc)
save_params(state, varspc, &restorelist, &removelist);
}
if (varspc) {
@@ -3643,6 +3643,8 @@ execcmd(Estate state, int input, int output, int how, int last1)
}
dont_queue_signals();
lastval = execbuiltin(args, assigns, (Builtin) hn);
+ if (do_save & BINF_COMMAND)
+ errflag &= ~ERRFLAG_ERROR;
restore_queue_signals(q);
fflush(stdout);
if (save[1] == -2) {
Messages sorted by:
Reverse Date,
Date,
Thread,
Author