Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXu Meng <mengxumx@cn.ibm.com>2019-12-07 05:54:00 +0300
committerMichaƫl Zasso <targos@protonmail.com>2019-12-10 12:09:41 +0300
commit60886036c9ff746d1d336e923cfb50afe72434ff (patch)
tree5905f86bc3cbb5d573206fd6b8a87d27e9b6d113 /src
parente551c169b8e70f1b479a10272f06b4b05a158c0c (diff)
src: fix the false isatty() issue on IBMi
On IBMi PASE isatty() always returns true for stdin, stdout and stderr. Use ioctl() instead to identify whether it's actually a TTY. PR-URL: https://github.com/nodejs/node/pull/30829 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/node.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/node.cc b/src/node.cc
index 91f07e447f0..b44f0210842 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -108,6 +108,9 @@
#include <unistd.h> // STDIN_FILENO, STDERR_FILENO
#endif
+#ifdef __PASE__
+#include <sys/ioctl.h> // ioctl
+#endif
// ========== global C++ headers ==========
#include <cerrno>
@@ -555,7 +558,14 @@ 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
s.isatty = true;
do