1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/io-console] Use TCSANOW to prevent from discarding the input buffer

TCSAFLUSH discards the buffer read before the mode change, which makes
IRB ignore the buffer input immediately after invoked.  TCSANOW
preserves the buffer.

https://github.com/ruby/io-console/commit/b362920182
This commit is contained in:
Yusuke Endoh 2019-12-14 19:15:02 +09:00 committed by Nobuyoshi Nakada
parent 81eb2d16ef
commit b39d5da974
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -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;