| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1d4e3d5 commit e00c4e4
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -97,6 +97,9 @@ | |||
| 97 | 97 | #include <unistd.h> // STDIN_FILENO, STDERR_FILENO | |
| 98 | 98 | #endif | |
| 99 | 99 | ||
| 100 | + #ifdef __PASE__ | ||
| 101 | + #include <sys/ioctl.h> // ioctl | ||
| 102 | + #endif | ||
| 100 | 103 | // ========== global C++ headers ========== | |
| 101 | 104 | ||
| 102 | 105 | #include <cerrno> | |
@@ -521,7 +524,14 @@ inline void PlatformInit() { | |||
| 521 | 524 | while (s.flags == -1 && errno == EINTR); // NOLINT | |
| 522 | 525 | CHECK_NE(s.flags, -1); | |
| 523 | 526 | ||
| 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 | ||
| 524 | 533 | if (!isatty(fd)) continue; | |
| 534 | + #endif | ||
| 525 | 535 | s.isatty = true; | |
| 526 | 536 | ||
| 527 | 537 | do | |
| Back | FazBrowse Home | New Git URL |
0 commit comments