aboutsummaryrefslogtreecommitdiff
path: root/docs/code/tty/main.c
diff options
context:
space:
mode:
authorJameson Nash <vtjnash@gmail.com>2018-08-28 10:47:17 -0400
committerSantiago Gimeno <santiago.gimeno@gmail.com>2018-09-19 18:19:28 +0200
commit40498795ab457dfa3a00a5aad45ba9db3bf71588 (patch)
tree6202925fc9668ff30a76df27526cd6dbb3c34403 /docs/code/tty/main.c
parent956bf6b71a3e79fad106d46ba3f0bcbf999c0651 (diff)
downloadlibuv-40498795ab457dfa3a00a5aad45ba9db3bf71588.tar.gz
libuv-40498795ab457dfa3a00a5aad45ba9db3bf71588.zip
stream: autodetect direction
Previously, we required the user to specify the expected read/write flags for a pipe or tty. But we've already been asking the OS to tell us what they actually are (fcntl F_GETFL), so we can hopefully just use that information directly. Fixes: https://github.com/libuv/libuv/issues/1936 PR-URL: https://github.com/libuv/libuv/pull/1964 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Diffstat (limited to 'docs/code/tty/main.c')
-rw-r--r--docs/code/tty/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/docs/code/tty/main.c b/docs/code/tty/main.c
index 03b26fbc..d44ec62c 100644
--- a/docs/code/tty/main.c
+++ b/docs/code/tty/main.c
@@ -8,7 +8,7 @@ uv_tty_t tty;
int main() {
loop = uv_default_loop();
- uv_tty_init(loop, &tty, 1, 0);
+ uv_tty_init(loop, &tty, STDOUT_FILENO, 0);
uv_tty_set_mode(&tty, UV_TTY_MODE_NORMAL);
if (uv_guess_handle(1) == UV_TTY) {