From 6534c6c7bda339e85689792b29f6731eada869e5 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sun, 12 Jan 2020 18:52:41 -0500 Subject: [PATCH] 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 Reviewed-By: Gireesh Punathil Reviewed-By: Ben Noordhuis Reviewed-By: David Carlier Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- src/node.cc | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/node.cc b/src/node.cc index 7da1fbb6689d4a..d46c78a927b39c 100644 --- a/src/node.cc +++ b/src/node.cc @@ -109,9 +109,6 @@ #include // STDIN_FILENO, STDERR_FILENO #endif -#ifdef __PASE__ -#include // ioctl -#endif // ========== global C++ headers ========== #include @@ -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