Index: utils/tests/pub/test_pub.dart |
diff --git a/utils/tests/pub/test_pub.dart b/utils/tests/pub/test_pub.dart |
index ba0ba0e86202c2b299e48abb88e1e2f3bf466eb9..61afc27b73c1eb5168a717b8244615d010a5a43e 100644 |
--- a/utils/tests/pub/test_pub.dart |
+++ b/utils/tests/pub/test_pub.dart |
@@ -1268,7 +1268,7 @@ Future<Pair<List<String>, List<String>>> schedulePackageValidation( |
}); |
} |
-/// A matcher that matches a Pair. |
+/// A matcher that matches a Pair. |
Matcher pairOf(Matcher firstMatcher, Matcher lastMatcher) => |
new _PairMatcher(firstMatcher, lastMatcher); |
@@ -1334,8 +1334,8 @@ class ScheduledProcess { |
/// Wraps a [Process] [Future] in a scheduled process. |
ScheduledProcess(this.name, Future<Process> process) |
: _process = process, |
- _stdout = process.transform((p) => new StringInputStream(p.stdout)), |
- _stderr = process.transform((p) => new StringInputStream(p.stderr)) { |
+ _stdout = process.transform((p) => _wrapStream(p.stdout)), |
+ _stderr = process.transform((p) => _wrapStream(p.stderr)) { |
_schedule((_) { |
if (!_endScheduled) { |
@@ -1466,6 +1466,12 @@ class ScheduledProcess { |
}); |
} |
+ /// Wraps [source] and ensures it gets eagerly drained. We do this to make |
+ /// sure a process will exit even if we don't care about its output. |
+ static Future<StringInputStream> _wrapStream(InputStream source) { |
+ return new StringInputStream(wrapInputStream(source)); |
+ } |
+ |
/// Prints the remaining data in the process's stdout and stderr streams. |
/// Prints nothing if the straems are empty. |
Future _printStreams() { |