From fda6e9692dfeb45e8734898a33ff31295c8bae4a Mon Sep 17 00:00:00 2001 From: jpco Date: Fri, 6 Sep 2024 11:50:23 -0700 Subject: [PATCH] Fix ^\ handling with readline, without breaking ^D handling with readline. --- input.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/input.c b/input.c index 6337c3b..98e9895 100644 --- a/input.c +++ b/input.c @@ -211,11 +211,13 @@ static char *callreadline(char *prompt) { if (!setjmp(slowlabel)) { slow = TRUE; r = interrupted ? NULL : readline(prompt); - } else + if (interrupted) + errno = EINTR; + } else { r = NULL; - slow = FALSE; - if (r == NULL) errno = EINTR; + } + slow = FALSE; SIGCHK(); return r; } @@ -298,9 +300,12 @@ static int fdfill(Input *in) { #if READLINE if (in->runflags & run_interactive && in->fd == 0) { - char *rlinebuf = callreadline(prompt); - if (rlinebuf == NULL) + char *rlinebuf = NULL; + do { + rlinebuf = callreadline(prompt); + } while (rlinebuf == NULL && errno == EINTR); + if (rlinebuf == NULL) nread = 0; else { if (*rlinebuf != '\0')