From b8649fdf00d0ddab8c95df2a5af80a5c3c97fca1 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 13 Feb 2012 22:37:21 +0100 Subject: [PATCH] unix: don't flush tty on switch to raw mode Drain, don't flush the tty when switching from cooked to raw mode. Prevents buffered keystrokes from getting lost. Switching back to cooked mode still flushes. Fixes joyent/node#2744. --- src/unix/tty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unix/tty.c b/src/unix/tty.c index 18a89216..c1429660 100644 --- a/src/unix/tty.c +++ b/src/unix/tty.c @@ -76,8 +76,8 @@ int uv_tty_set_mode(uv_tty_t* tty, int mode) { raw.c_cc[VMIN] = 1; raw.c_cc[VTIME] = 0; - /* Put terminal in raw mode after flushing */ - if (tcsetattr(fd, TCSAFLUSH, &raw)) { + /* Put terminal in raw mode after draining */ + if (tcsetattr(fd, TCSADRAIN, &raw)) { goto fatal; }