summaryrefslogtreecommitdiff
path: root/ext/io/console/console.c
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-12-14 19:15:02 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-12-17 13:55:05 +0900
commitb39d5da97426c6f65e2b39b307ce19d774d93ddd (patch)
tree716179ae25b7ee1082276d49c1ec742e3b875b63 /ext/io/console/console.c
parent81eb2d16efcb29899e88e30a25ca5440195e2393 (diff)
[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
Diffstat (limited to 'ext/io/console/console.c')
-rw-r--r--ext/io/console/console.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index ec70bdf9df..9bd825aaa0 100644
--- a/ext/io/console/console.c
+++ b/ext/io/console/console.c
@@ -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;