From 1399d851b112ad8376ef2a46303e72fd55125439 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Thu, 4 Aug 2016 14:35:39 -0400 Subject: [PATCH] tty,unix: avoid affecting controlling TTY Since this re-open logic is supposed to be transparent to the parent program, this flag helps ensure that there are no unintended side-effects. This flag is already the default (and only possible option) on FreeBSD. Normally, Linux will also act as if you passed NOCTTY. However, it appears that mac OS sometimes strips the parent process of its controlling terminal if you don't pass this flag. Fixes: https://github.com/libuv/libuv/issues/973 Fixes: https://github.com/JuliaLang/julia/issues/16398 PR-URL: https://github.com/libuv/libuv/pull/2619 Reviewed-By: Ben Noordhuis --- src/unix/tty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/tty.c b/src/unix/tty.c index 2385911c..ff7d3b17 100644 --- a/src/unix/tty.c +++ b/src/unix/tty.c @@ -139,7 +139,7 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int unused) { * slave device. */ if (uv__tty_is_slave(fd) && ttyname_r(fd, path, sizeof(path)) == 0) - r = uv__open_cloexec(path, mode); + r = uv__open_cloexec(path, mode | O_NOCTTY); else r = -1;