| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e551c16 commit 6088603
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -108,6 +108,9 @@ | |||
| 108 | 108 | #include <unistd.h> // STDIN_FILENO, STDERR_FILENO | |
| 109 | 109 | #endif | |
| 110 | 110 | ||
| 111 | + #ifdef __PASE__ | ||
| 112 | + #include <sys/ioctl.h> // ioctl | ||
| 113 | + #endif | ||
| 111 | 114 | // ========== global C++ headers ========== | |
| 112 | 115 | ||
| 113 | 116 | #include <cerrno> | |
@@ -555,7 +558,14 @@ inline void PlatformInit() { | |||
| 555 | 558 | while (s.flags == -1 && errno == EINTR); // NOLINT | |
| 556 | 559 | CHECK_NE(s.flags, -1); | |
| 557 | 560 | ||
| 561 | + #ifdef __PASE__ | ||
| 562 | + // On IBMi PASE isatty() always returns true for stdin, stdout and stderr. | ||
| 563 | + // Use ioctl() instead to identify whether it's actually a TTY. | ||
| 564 | + if (ioctl(fd, TXISATTY + 0x81, nullptr) == -1 && errno == ENOTTY) | ||
| 565 | + continue; | ||
| 566 | + #else | ||
| 558 | 567 | if (!isatty(fd)) continue; | |
| 568 | + #endif | ||
| 559 | 569 | s.isatty = true; | |
| 560 | 570 | ||
| 561 | 571 | do | |
| Back | FazBrowse Home | New Git URL |
0 commit comments