Skip to content

Commit

Permalink
stream: autodetect direction
Browse files Browse the repository at this point in the history
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: libuv/libuv#1936
PR-URL: libuv/libuv#1964
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
  • Loading branch information
vtjnash authored and inkydragon committed Aug 28, 2018
1 parent 384b34c commit e08df9b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/code/tty-gravity/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void update(uv_timer_t *req) {
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, 0);

if (uv_tty_get_winsize(&tty, &width, &height)) {
Expand Down
2 changes: 1 addition & 1 deletion docs/code/tty/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e08df9b

Please sign in to comment.