Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1743738

Browse filesBrowse files
dmabupttargos
authored andcommitted
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: #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>
1 parent 50afd34 commit 1743738
Copy full SHA for 1743738

File tree

Expand file treeCollapse file tree

1 file changed

+10
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-0
lines changed
Open diff view settings
Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@
9797
#include <unistd.h> // STDIN_FILENO, STDERR_FILENO
9898
#endif
9999

100+
#ifdef __PASE__
101+
#include <sys/ioctl.h> // ioctl
102+
#endif
100103
// ========== global C++ headers ==========
101104

102105
#include <cerrno>
@@ -521,7 +524,14 @@ inline void PlatformInit() {
521524
while (s.flags == -1 && errno == EINTR); // NOLINT
522525
CHECK_NE(s.flags, -1);
523526

527+
#ifdef __PASE__
528+
// On IBMi PASE isatty() always returns true for stdin, stdout and stderr.
529+
// Use ioctl() instead to identify whether it's actually a TTY.
530+
if (ioctl(fd, TXISATTY + 0x81, nullptr) == -1 && errno == ENOTTY)
531+
continue;
532+
#else
524533
if (!isatty(fd)) continue;
534+
#endif
525535
s.isatty = true;
526536

527537
do

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.