Skip to content

winio: fix detection of tty terminals

Tamar Christina requested to merge Phyx/ghc:gh-2189-fix-tty-detection into master

Fix TTY detection code.

Currently it's having issues miss-detecting the NUL device. The current code assumes anything of type FILE_TYPE_CHAR is a TTY, however the NUL device has type FILE_TYPE_CHAR but can't be used with the native console APIs.

Instead default to anything not of type FILE_TYPE_CHAR is not a TTY and perform an additional check to see if things of type FILE_TYPE_CHAR have a console mode.

Fixes #18492 (closed)

Merge request reports