Revert "unix: use cfmakeraw() for setting raw TTY mode"

This reverts commit 0f25560c8a.

This change was introduced to make it possible to use the TTY for binary
I/O but unfortunately it breaks libuv users that depend on the OPOST and
ONLCR flags, like node.js.

There is no point in adding those flags after the call to cfmakeraw()
because that would once again make the TTY unsuitable for binary I/O.
Let's revert it for now and revisit it again later.

Fixes libuv/libuv#32, reverts joyent/libuv#1567.

PR-URL: https://github.com/libuv/libuv/pull/33
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit is contained in:
Ben Noordhuis 2014-12-04 19:04:35 +01:00
parent e7895debea
commit 484a3a92a8

View File

@ -123,7 +123,12 @@ int uv_tty_set_mode(uv_tty_t* tty, int mode) {
uv_spinlock_unlock(&termios_spinlock);
raw = tty->orig_termios;
cfmakeraw(&raw);
raw.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON);
raw.c_oflag |= (ONLCR);
raw.c_cflag |= (CS8);
raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG);
raw.c_cc[VMIN] = 1;
raw.c_cc[VTIME] = 0;
/* Put terminal in raw mode after draining */
if (tcsetattr(fd, TCSADRAIN, &raw))