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

Unified Diff: utils/pub/io.dart

Issue 11474046: Make sure to drain stderr in tests so that spawned process doesn't hang. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 | « no previous file | utils/pub/log.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/io.dart
diff --git a/utils/pub/io.dart b/utils/pub/io.dart
index 968f3546fbc4bcf77b02797f0ab46dc99357435c..146f1e6853e88bdecae638cb73aa4b473a30dd77 100644
--- a/utils/pub/io.dart
+++ b/utils/pub/io.dart
@@ -605,6 +605,18 @@ Future<String> consumeStringInputStream(StringInputStream stream) {
return completer.future;
}
+/// Wrap an InputStream in a ListInputStream. This eagerly drains the [source]
+/// input stream. This is useful for spawned processes which will not exit until
+/// their output streams have been drained.
nweiz 2012/12/08 02:06:46 Mention the issue number here.
Bob Nystrom 2012/12/08 02:37:05 Done.
+InputStream wrapInputStream(InputStream source) {
+ var sink = new ListInputStream();
+ // TODO(nweiz): Due to issuee 3657, pipeInputToInput naturally avoids calling
+ // both onClosed and onError. If 3657 gets fixed before 7013, we'll need to do
+ // that explicitly.
nweiz 2012/12/08 02:06:46 This comment is no longer relevant.
Bob Nystrom 2012/12/08 02:37:05 Done.
+ pipeInputToInput(source, sink);
+ return sink;
+}
+
/// Spawns and runs the process located at [executable], passing in [args].
/// Returns a [Future] that will complete with the results of the process after
/// it has ended.
« no previous file with comments | « no previous file | utils/pub/log.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698