diff options
author | cjihrig <cjihrig@gmail.com> | 2020-01-13 02:52:41 +0300 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2020-01-16 09:44:46 +0300 |
commit | 6534c6c7bda339e85689792b29f6731eada869e5 (patch) | |
tree | 144ec20a21ca3b548bc3140b1969dddb8642393c /src/node.cc | |
parent | 6d6a3e4551b2c807553cb2380dbbf2cb0154e400 (diff) |
src: use uv_guess_handle() to detect TTYs
This commit reverts https://github.com/nodejs/node/pull/30829
and uses uv_guess_handle() instead of isatty(). The IBMi
changes are no longer required, as of libuv 1.34.1.
PR-URL: https://github.com/nodejs/node/pull/31333
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src/node.cc')
-rw-r--r-- | src/node.cc | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/src/node.cc b/src/node.cc index 7da1fbb6689..d46c78a927b 100644 --- a/src/node.cc +++ b/src/node.cc @@ -109,9 +109,6 @@ #include <unistd.h> // STDIN_FILENO, STDERR_FILENO #endif -#ifdef __PASE__ -#include <sys/ioctl.h> // ioctl -#endif // ========== global C++ headers ========== #include <cerrno> @@ -589,14 +586,7 @@ inline void PlatformInit() { while (s.flags == -1 && errno == EINTR); // NOLINT CHECK_NE(s.flags, -1); -#ifdef __PASE__ - // On IBMi PASE isatty() always returns true for stdin, stdout and stderr. - // Use ioctl() instead to identify whether it's actually a TTY. - if (ioctl(fd, TXISATTY + 0x81, nullptr) == -1 && errno == ENOTTY) - continue; -#else - if (!isatty(fd)) continue; -#endif + if (uv_guess_handle(fd) != UV_TTY) continue; s.isatty = true; do |