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

Unified Diff: sdk/lib/_internal/pub/lib/src/utils.dart

Issue 14593010: Log verbose output when testing pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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
Index: sdk/lib/_internal/pub/lib/src/utils.dart
diff --git a/sdk/lib/_internal/pub/lib/src/utils.dart b/sdk/lib/_internal/pub/lib/src/utils.dart
index 2f705f9e192fcd441ca4c91145537e20cef2b6a2..08b0fb44c26f48661fd0dcee321590223c9fa8e8 100644
--- a/sdk/lib/_internal/pub/lib/src/utils.dart
+++ b/sdk/lib/_internal/pub/lib/src/utils.dart
@@ -213,6 +213,26 @@ Pair<Stream, Stream> tee(Stream stream) {
return new Pair<Stream, Stream>(controller1.stream, controller2.stream);
}
+/// Merges [stream1] and [stream2] into a single stream that emits events from
+/// both sources.
+Stream mergeStreams(Stream stream1, Stream stream2) {
+ var doneCount = 0;
+ var controller = new StreamController();
+
+ for (var stream in [stream1, stream2]) {
+ stream.listen((value) {
+ controller.add(value);
+ }, onError: (error) {
+ controller.addError(error);
+ }, onDone: () {
+ doneCount++;
+ if (doneCount == 2) controller.close();
+ });
+ }
+
+ return controller.stream;
+}
+
/// A regular expression matching a trailing CR character.
final _trailingCR = new RegExp(r"\r$");
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/io.dart ('k') | sdk/lib/_internal/pub/test/lish/archives_and_uploads_a_package_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698