diff --git a/src/unix/tty.c b/src/unix/tty.c index a1ea433f..b1782df9 100644 --- a/src/unix/tty.c +++ b/src/unix/tty.c @@ -103,6 +103,24 @@ skip: return 0; } +static void uv__tty_make_raw(struct termios* tio) { + assert(tio != NULL); + +#ifdef __sun + /* + * This implementation of cfmakeraw for Solaris and derivatives is taken from + * http://www.perkin.org.uk/posts/solaris-portability-cfmakeraw.html. + */ + tio->c_iflag &= ~(IMAXBEL | IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | + IGNCR | ICRNL | IXON); + tio->c_oflag &= ~OPOST; + tio->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); + tio->c_cflag &= ~(CSIZE | PARENB); + tio->c_cflag |= CS8; +#else + cfmakeraw(tio); +#endif /* #ifdef __sun */ +} int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) { struct termios tmp; @@ -138,7 +156,7 @@ int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) { tmp.c_cc[VTIME] = 0; break; case UV_TTY_MODE_IO: - cfmakeraw(&tmp); + uv__tty_make_raw(&tmp); break; }