ruby-changes:59292
From: Yusuke <ko1@a...>
Date: Tue, 17 Dec 2019 15:12:21 +0900 (JST)
Subject: [ruby-changes:59292] b39d5da974 (master): [ruby/io-console] Use TCSANOW to prevent from discarding the input buffer
https://git.ruby-lang.org/ruby.git/commit/?id=b39d5da974 From b39d5da97426c6f65e2b39b307ce19d774d93ddd Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Sat, 14 Dec 2019 19:15:02 +0900 Subject: [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 diff --git a/ext/io/console/console.c b/ext/io/console/console.c index ec70bdf..9bd825a 100644 --- a/ext/io/console/console.c +++ b/ext/io/console/console.c @@ -23,7 +23,7 @@ typedef struct termios conmode; https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L23 static int setattr(int fd, conmode *t) { - while (tcsetattr(fd, TCSAFLUSH, t)) { + while (tcsetattr(fd, TCSANOW, t)) { if (errno != EINTR) return 0; } return 1; -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/