Index: runtime/bin/stdio_patch.dart |
diff --git a/runtime/bin/stdio_patch.dart b/runtime/bin/stdio_patch.dart |
index d400306afac138fc03d3ee92b470303a432962e9..ffc47031ba09e6759feeb3def85899cf6fe3020c 100644 |
--- a/runtime/bin/stdio_patch.dart |
+++ b/runtime/bin/stdio_patch.dart |
@@ -17,20 +17,13 @@ patch class _StdIOUtils { |
} |
static _getStdioOutputStream(int fd) { |
- wrap(sink) { |
- if (fd == 1) { |
- return new Stdout._(sink); |
- } else { |
- return new _StdSink(sink); |
- } |
- } |
assert(fd == 1 || fd == 2); |
switch (_getStdioHandleType(fd)) { |
case _STDIO_HANDLE_TYPE_TERMINAL: |
case _STDIO_HANDLE_TYPE_PIPE: |
case _STDIO_HANDLE_TYPE_SOCKET: |
case _STDIO_HANDLE_TYPE_FILE: |
- return wrap(new IOSink(new _FileStreamConsumer.fromStdio(fd))); |
+ return new Stdout._(new IOSink(new _StdConsumer(fd)), fd); |
default: |
throw new FileSystemException("Unsupported stdin type"); |
} |
@@ -63,27 +56,27 @@ patch class Stdin { |
} |
patch class Stdout { |
- /* patch */ bool get hasTerminal { |
+ /* patch */ bool _hasTerminal(int fd) { |
try { |
- _terminalSize; |
+ _terminalSize(fd); |
return true; |
} catch (_) { |
return false; |
} |
} |
- /* patch */ int get terminalColumns => _terminalSize[0]; |
- /* patch */ int get terminalLines => _terminalSize[1]; |
+ /* patch */ int _terminalColumns(int fd) => _terminalSize(fd)[0]; |
+ /* patch */ int _terminalLines(int fd) => _terminalSize(fd)[1]; |
- static List get _terminalSize { |
- var size = _getTerminalSize(); |
+ static List _terminalSize(int fd) { |
+ var size = _getTerminalSize(fd); |
if (size is! List) { |
throw new StdoutException("Could not get terminal size", size); |
} |
return size; |
} |
- static _getTerminalSize() native "Stdout_GetTerminalSize"; |
+ static _getTerminalSize(int fd) native "Stdout_GetTerminalSize"; |
} |