Skip to content

Commit

Permalink
FIXED: #1097 ctrl-C in read causes exit from REPL
Browse files Browse the repository at this point in the history
Fix consists of two parts.  (1) if something (libedit) already set the
stream error condition, make S__fillbuf() return with an error immediately
and (2) do not abort the main query loop if we get an abort request.
  • Loading branch information
JanWielemaker committed Sep 17, 2023
1 parent 2b56856 commit 9728ba8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/os/pl-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,8 @@ S__fillbuf(IOSTREAM *s)
{ if ( !(s->flags & SIO_NOFEOF) )
s->flags |= SIO_FEOF;
return -1;
} else if ( Sferror(s) )
{ return -1;
#ifdef EWOULDBLOCK
} else if ( errno == EWOULDBLOCK )
{ s->bufp = s->buffer;
Expand Down
5 changes: 4 additions & 1 deletion src/pl-pro.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ query_loop(atom_t goal, int loop)
}

if ( !rc && (except = PL_exception(qid)) )
{ if ( Sferror(Suser_input) ||
{ if ( classify_exception(except) == EXCEPT_ABORT )
Sclearerr(Suser_input);

if ( Sferror(Suser_input) ||
Sferror(Suser_output) ||
Sferror(Suser_error) )
return -1;
Expand Down

0 comments on commit 9728ba8

Please sign in to comment.