Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Error in zshaddhistory() should not prevent command from running



[Fourth attempt sending this, primenet is blocking gmail again.]

Should this actually be in callhookfunc() itself?  I note that the doc
warns about errors in precmd killing off periodic, or else I'd say it
ought to be.

Possibly more controversial, why run this hook at all when nothing is
being added?

diff --git a/Src/hist.c b/Src/hist.c
index 97fd340..350688d 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -1418,7 +1418,7 @@ hend(Eprog prog)
   DPUTS(hptr < chline, "History end pointer off start of line");
   *hptr = '\0';
     }
-    {
+    if (*chline) {
     LinkList hookargs = newlinklist();
     int save_errflag = errflag;
     errflag = 0;
@@ -1427,6 +1427,7 @@ hend(Eprog prog)
   addlinknode(hookargs, chline);
   callhookfunc("zshaddhistory", hookargs, 1, &hookret);

+	errflag &= ~ERRFLAG_ERROR;
	errflag |= save_errflag;
     }
     /* For history sharing, lock history file once for both read and write */



Messages sorted by: Reverse Date, Date, Thread, Author