ibmi: 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/libuv/libuv/pull/2565 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This commit is contained in:
parent
d077d066fd
commit
e14c56bd90
@ -293,7 +293,14 @@ uv_handle_type uv_guess_handle(uv_file file) {
|
||||
if (file < 0)
|
||||
return UV_UNKNOWN_HANDLE;
|
||||
|
||||
#if defined(__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(file, TXISATTY + 0x81, NULL) || errno != ENOTTY)
|
||||
#else
|
||||
if (isatty(file))
|
||||
#endif
|
||||
return UV_TTY;
|
||||
|
||||
if (fstat(file, &s))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user