diff options
author | Peter Stephenson <pws@zsh.org> | 2016-09-14 10:32:29 +0100 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2016-09-14 10:33:18 +0100 |
commit | a4b8ee13be494c8732c0348857befe87951a058b (patch) | |
tree | 5db582aeb688e4a1520f205a268765602f5b61e4 /Src | |
parent | be4c072cf50ffcc2e2c34e4edbb0e2a78900206b (diff) | |
download | zsh-a4b8ee13be494c8732c0348857befe87951a058b.tar.gz zsh-a4b8ee13be494c8732c0348857befe87951a058b.tar.xz zsh-a4b8ee13be494c8732c0348857befe87951a058b.zip |
zsh-users/21903: Fix ${...?...} in interactive shell.
On failure should abort back to top level, but we reset the error flag around commands. Add a hard error flag that's only reset at top level.
Diffstat (limited to 'Src')
-rw-r--r-- | Src/subst.c | 7 | ||||
-rw-r--r-- | Src/zsh.h | 9 |
2 files changed, 15 insertions, 1 deletions
diff --git a/Src/subst.c b/Src/subst.c index 1c2027f32..92fde4598 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -2922,6 +2922,13 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags, if (isset(EXECOPT)) { *idend = '\0'; zerr("%s: %s", idbeg, *s ? s : "parameter not set"); + /* + * In interactive shell we need to return to + * top-level prompt --- don't clear this error + * after handling a command as we do with + * most errors. + */ + errflag |= ERRFLAG_HARD; if (!interact) { if (mypid == getpid()) { /* diff --git a/Src/zsh.h b/Src/zsh.h index 996bc3369..2dc5e7e2a 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -2807,7 +2807,14 @@ enum errflag_bits { /* * User interrupt. */ - ERRFLAG_INT = 2 + ERRFLAG_INT = 2, + /* + * Hard error --- return to top-level prompt in interactive + * shell. In non-interactive shell we'll typically already + * have exited. This is reset by "errflag = 0" in + * loop(toplevel = 1, ...). + */ + ERRFLAG_HARD = 4 }; /***********/ |