Skip to content

Commit

Permalink
src: use uv_guess_handle() to detect TTYs
Browse files Browse the repository at this point in the history
This commit reverts #30829
and uses uv_guess_handle() instead of isatty(). The IBMi
changes are no longer required, as of libuv 1.34.1.

PR-URL: #31333
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
cjihrig authored and codebytere committed Mar 14, 2020
1 parent e883136 commit 7b0687d
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@
#include <unistd.h> // STDIN_FILENO, STDERR_FILENO
#endif

#ifdef __PASE__
#include <sys/ioctl.h> // ioctl
#endif
// ========== global C++ headers ==========

#include <cerrno>
Expand Down Expand Up @@ -555,14 +552,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
Expand Down

0 comments on commit 7b0687d

Please sign in to comment.