diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | Src/hist.c | 15 |
2 files changed, 14 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog index e70ed9d80..a5fce1d79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-01-27 Barton E. Schaefer <schaefer@zsh.org> + * 37819: Src/hist.c: zshaddhistory hook is intended to work for + any history file write, even upon keyboard interrupt + * 37810: Src/Modules/zutil.c: repair handling of backslashes and of names starting with "+"/":"/"=" in zparseopts option specs diff --git a/Src/hist.c b/Src/hist.c index 007366a49..7f9e4dbbb 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -1378,7 +1378,6 @@ should_ignore_line(Eprog prog) mod_export int hend(Eprog prog) { - LinkList hookargs = newlinklist(); int flag, hookret, stack_pos = histsave_stack_pos; /* * save: @@ -1418,9 +1417,17 @@ hend(Eprog prog) DPUTS(hptr < chline, "History end pointer off start of line"); *hptr = '\0'; } - addlinknode(hookargs, "zshaddhistory"); - addlinknode(hookargs, chline); - callhookfunc("zshaddhistory", hookargs, 1, &hookret); + { + LinkList hookargs = newlinklist(); + int save_errflag = errflag; + errflag = 0; + + addlinknode(hookargs, "zshaddhistory"); + addlinknode(hookargs, chline); + callhookfunc("zshaddhistory", hookargs, 1, &hookret); + + errflag |= save_errflag; + } /* For history sharing, lock history file once for both read and write */ hf = getsparam("HISTFILE"); if (isset(SHAREHISTORY) && !lockhistfile(hf, 0)) { |