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. |