Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(600)

Unified Diff: runtime/bin/stdio_patch.dart

Issue 850333002: Revert "Revert "Make stdout/stderr async"" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/stdio_macos.cc ('k') | runtime/bin/stdio_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/stdio_patch.dart
diff --git a/runtime/bin/stdio_patch.dart b/runtime/bin/stdio_patch.dart
index ffc47031ba09e6759feeb3def85899cf6fe3020c..d400306afac138fc03d3ee92b470303a432962e9 100644
--- a/runtime/bin/stdio_patch.dart
+++ b/runtime/bin/stdio_patch.dart
@@ -17,13 +17,20 @@ 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 new Stdout._(new IOSink(new _StdConsumer(fd)), fd);
+ return wrap(new IOSink(new _FileStreamConsumer.fromStdio(fd)));
default:
throw new FileSystemException("Unsupported stdin type");
}
@@ -56,27 +63,27 @@ patch class Stdin {
}
patch class Stdout {
- /* patch */ bool _hasTerminal(int fd) {
+ /* patch */ bool get hasTerminal {
try {
- _terminalSize(fd);
+ _terminalSize;
return true;
} catch (_) {
return false;
}
}
- /* patch */ int _terminalColumns(int fd) => _terminalSize(fd)[0];
- /* patch */ int _terminalLines(int fd) => _terminalSize(fd)[1];
+ /* patch */ int get terminalColumns => _terminalSize[0];
+ /* patch */ int get terminalLines => _terminalSize[1];
- static List _terminalSize(int fd) {
- var size = _getTerminalSize(fd);
+ static List get _terminalSize {
+ var size = _getTerminalSize();
if (size is! List) {
throw new StdoutException("Could not get terminal size", size);
}
return size;
}
- static _getTerminalSize(int fd) native "Stdout_GetTerminalSize";
+ static _getTerminalSize() native "Stdout_GetTerminalSize";
}
« no previous file with comments | « runtime/bin/stdio_macos.cc ('k') | runtime/bin/stdio_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698