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

Unified Diff: pkg/scheduled_test/lib/scheduled_process.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
« no previous file with comments | « no previous file | pkg/scheduled_test/lib/src/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/scheduled_test/lib/scheduled_process.dart
diff --git a/pkg/scheduled_test/lib/scheduled_process.dart b/pkg/scheduled_test/lib/scheduled_process.dart
index 45e50616dbce1f8b41a03809a47fc610a15c6460..ad6d4daa4fd8b194928788e1e530fe10d0c8eaee 100644
--- a/pkg/scheduled_test/lib/scheduled_process.dart
+++ b/pkg/scheduled_test/lib/scheduled_process.dart
@@ -95,16 +95,15 @@ class ScheduledProcess {
var stdoutWithCanceller = _lineStreamWithCanceller(
_process.then((p) => p.stdout));
_stdoutCanceller = stdoutWithCanceller.last;
- var stdoutTee = tee(stdoutWithCanceller.first);
- _stdout = stdoutTee.first;
- _stdoutLog = stdoutTee.last;
+ _stdoutLog = stdoutWithCanceller.first;
var stderrWithCanceller = _lineStreamWithCanceller(
_process.then((p) => p.stderr));
_stderrCanceller = stderrWithCanceller.last;
- var stderrTee = tee(stderrWithCanceller.first);
- _stderr = stderrTee.first;
- _stderrLog = stderrTee.last;
+ _stderrLog = stderrWithCanceller.first;
+
+ _stdout = stdoutStream();
+ _stderr = stderrStream();
}
/// Updates [_description] to reflect [executable] and [arguments], which are
@@ -186,7 +185,7 @@ class ScheduledProcess {
/// Converts a stream of bytes to a stream of lines and returns that along
/// with a [StreamCanceller] controlling it.
Pair<Stream<String>, StreamCanceller> _lineStreamWithCanceller(
- Future<Stream<int>> streamFuture) {
+ Future<Stream<List<int>>> streamFuture) {
return streamWithCanceller(futureStream(streamFuture)
.handleError((e) => currentSchedule.signalError(e))
.transform(new StringDecoder(_encoding))
@@ -266,6 +265,32 @@ class ScheduledProcess {
"reading the remaining stderr from process '$description'");
}
+ /// Returns a stream that will emit anything the process emits via the
+ /// process's standard output from now on.
+ ///
+ /// This stream will be independent from any other methods that deal with
+ /// standard output, including other calls to [stdoutStream].
+ ///
+ /// This can be overridden by subclasses to return a derived standard output
+ /// stream. This stream will then be used for [nextLine], [nextErrLine],
+ /// [remainingStdout], and [remainingStderr].
+ Stream<String> stdoutStream() {
+ var pair = tee(_stdoutLog);
+ _stdoutLog = pair.first;
+ return pair.last;
+ }
+
+ /// Returns a stream that will emit anything the process emits via the
+ /// process's standard error from now on.
+ ///
+ /// This stream will be independent from any other methods that deal with
+ /// standard error, including other calls to [stderrStream].
+ Stream<String> stderrStream() {
+ var pair = tee(_stderrLog);
+ _stderrLog = pair.first;
+ return pair.last;
+ }
+
/// Writes [line] to the process as stdin.
void writeLine(String line) {
schedule(() {
« no previous file with comments | « no previous file | pkg/scheduled_test/lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698