Skip to content

Commit

Permalink
Do not use _isatty
Browse files Browse the repository at this point in the history
  • Loading branch information
nojb committed Nov 18, 2017
1 parent 2b82404 commit 0669c40
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion byterun/win32.c
Expand Up @@ -967,5 +967,9 @@ static int caml_win32_ismsystty(int fd)

CAMLexport int caml_win32_isatty(int fd)
{
return _isatty(fd) || caml_win32_ismsystty(fd);
DWORD lpMode;
HANDLE hFile = (HANDLE)_get_osfhandle(fd);
return (hFile != INVALID_HANDLE_VALUE &&
GetFileType(hFile) == FILE_TYPE_CHAR &&
GetConsoleMode(hFile, &lpMode)) || caml_win32_ismsystty(fd);
}

0 comments on commit 0669c40

Please sign in to comment.