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 <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>
  • 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.