aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbutl/fdstream.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/libbutl/fdstream.cxx b/libbutl/fdstream.cxx
index 07cb9f2..df5b531 100644
--- a/libbutl/fdstream.cxx
+++ b/libbutl/fdstream.cxx
@@ -1889,7 +1889,13 @@ namespace butl
throw_system_ios_failure (e);
if (t == FILE_TYPE_CHAR) // Terminal.
- return true;
+ {
+ // One notable special file that has this type is nul (as returned by
+ // fdopen_null()). So tighten this case with the GetConsoleMode() call.
+ //
+ DWORD m;
+ return GetConsoleMode (h, &m) != 0;
+ }
if (t != FILE_TYPE_PIPE) // Pipe still can be a terminal (see below).
return false;