Skip to content

Commit

Permalink
Fix ^\ handling with readline, without breaking ^D handling with read…
Browse files Browse the repository at this point in the history
…line.
  • Loading branch information
jpco committed Sep 11, 2024
1 parent 15614b2 commit a7db5c5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions input.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit a7db5c5

Please sign in to comment.