Skip to content

Commit

Permalink
Use TCSANOW to prevent from discarding the input buffer
Browse files Browse the repository at this point in the history
TCSAFLUSH discards the buffer read before the mode change, which makes
IRB ignore the buffer input immediately after invoked.  TCSANOW
preserves the buffer.
  • Loading branch information
mame authored and nobu committed Dec 14, 2019
1 parent e9e8e3f commit b362920
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ext/io/console/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ typedef struct termios conmode;
static int
setattr(int fd, conmode *t)
{
while (tcsetattr(fd, TCSAFLUSH, t)) {
while (tcsetattr(fd, TCSANOW, t)) {
if (errno != EINTR) return 0;
}
return 1;
Expand Down

0 comments on commit b362920

Please sign in to comment.