Index: sdk/lib/io/stdio.dart |
diff --git a/sdk/lib/io/stdio.dart b/sdk/lib/io/stdio.dart |
index 5c1fa8f734fa04146c3194a2744b3a468a0e7e67..5b5e62f539c7b0a669d7760ca83769441ac4ed4c 100644 |
--- a/sdk/lib/io/stdio.dart |
+++ b/sdk/lib/io/stdio.dart |
@@ -273,8 +273,12 @@ IOSink get stderr { |
StdioType stdioType(object) { |
if (object is _StdStream) { |
object = object._stream; |
- } else if (object is _StdSink) { |
- object = object._sink; |
+ } else if (object == stdout || object == stderr) { |
+ switch (_StdIOUtils._getStdioHandleType(object == stdout ? 1 : 2)) { |
+ case _STDIO_HANDLE_TYPE_TERMINAL: return StdioType.TERMINAL; |
+ case _STDIO_HANDLE_TYPE_PIPE: return StdioType.PIPE; |
+ case _STDIO_HANDLE_TYPE_FILE: return StdioType.FILE; |
+ } |
} |
if (object is _FileStream) { |
return StdioType.FILE; |
@@ -303,4 +307,5 @@ class _StdIOUtils { |
external static _getStdioOutputStream(int fd); |
external static Stdin _getStdioInputStream(); |
external static int _socketType(nativeSocket); |
+ external static _getStdioHandleType(int fd); |
} |