diff options
Diffstat (limited to 'Src')
-rw-r--r-- | Src/hist.c | 2 | ||||
-rw-r--r-- | Src/init.c | 9 | ||||
-rw-r--r-- | Src/options.c | 1 | ||||
-rw-r--r-- | Src/zsh.h | 1 |
4 files changed, 10 insertions, 3 deletions
diff --git a/Src/hist.c b/Src/hist.c index 0e63dca37..561e2acd5 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -573,7 +573,7 @@ histsubchar(int c) } else { herrflush(); unqueue_signals(); - zerr("Ambiguous history reference"); + zerr("ambiguous history reference"); return -1; } diff --git a/Src/init.c b/Src/init.c index 6c2ba13e4..8467a739c 100644 --- a/Src/init.c +++ b/Src/init.c @@ -1608,15 +1608,20 @@ zsh_main(UNUSED(int argc), char **argv) * We only do this at top level, because if we are * executing stuff we may refer to them by job pointer. */ + int errexit = 0; maybeshrinkjobtab(); do { /* Reset return from top level which gets us back here */ retflag = 0; loop(1,0); + if (errflag && !interact && !isset(CONTINUEONERROR)) { + errexit = 1; + break; + } } while (tok != ENDINPUT && (tok != LEXERR || isset(SHINSTDIN))); - if (tok == LEXERR) { - /* Make sure a parse error exits with non-zero status */ + if (tok == LEXERR || errexit) { + /* Make sure a fatal error exits with non-zero status */ if (!lastval) lastval = 1; stopmsg = 1; diff --git a/Src/options.c b/Src/options.c index 80fef3d00..b36bd9944 100644 --- a/Src/options.c +++ b/Src/options.c @@ -113,6 +113,7 @@ static struct optname optns[] = { {{NULL, "combiningchars", 0}, COMBININGCHARS}, {{NULL, "completealiases", 0}, COMPLETEALIASES}, {{NULL, "completeinword", 0}, COMPLETEINWORD}, +{{NULL, "continueonerror", 0}, CONTINUEONERROR}, {{NULL, "correct", 0}, CORRECT}, {{NULL, "correctall", 0}, CORRECTALL}, {{NULL, "cshjunkiehistory", OPT_EMULATE|OPT_CSH}, CSHJUNKIEHISTORY}, diff --git a/Src/zsh.h b/Src/zsh.h index e51572bcf..207ef1836 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -1971,6 +1971,7 @@ enum { COMPLETEINWORD, CORRECT, CORRECTALL, + CONTINUEONERROR, CPRECEDENCES, CSHJUNKIEHISTORY, CSHJUNKIELOOPS, |