From 1e4577b9b7f264bd4a3f6bbeac1823501faf886f Mon Sep 17 00:00:00 2001 From: Max Peterson Date: Thu, 3 Sep 2015 00:14:05 -0500 Subject: [PATCH] Prevent pub serve errors from examples task --- .gitignore | 1 + lib/src/tasks/examples/api.dart | 13 ++++++++----- lib/src/tasks/examples/cli.dart | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index fd3b4bcd..7677080a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.packages .pub packages pubspec.lock diff --git a/lib/src/tasks/examples/api.dart b/lib/src/tasks/examples/api.dart index 3d7933a9..63a3363b 100644 --- a/lib/src/tasks/examples/api.dart +++ b/lib/src/tasks/examples/api.dart @@ -52,8 +52,8 @@ ExamplesTask serveExamples( '$pubServeExecutable ${pubServeArgs.join(' ')}', Future.wait([dartiumProcess.done, pubServeProcess.done])); - pubServeProcess.stdout.listen(task._pubServeOutput.add); - pubServeProcess.stderr.listen(task._pubServeOutput.addError); + pubServeProcess.stdout.listen(task._pubServeStdOut.add); + pubServeProcess.stderr.listen(task._pubServeStdErr.add); pubServeProcess.exitCode.then((code) { task.successful = code <= 0; }); @@ -70,16 +70,19 @@ class ExamplesTask extends Task { final String pubServeCommand; StreamController _dartiumOutput = new StreamController(); - StreamController _pubServeOutput = new StreamController(); + StreamController _pubServeStdOut = new StreamController(); + StreamController _pubServeStdErr = new StreamController(); ExamplesTask(String this.dartiumCommand, String this.pubServeCommand, Future this.done) { done.then((_) { _dartiumOutput.close(); - _pubServeOutput.close(); + _pubServeStdOut.close(); + _pubServeStdErr.close(); }); } Stream get dartiumOutput => _dartiumOutput.stream; - Stream get pubServeOutput => _pubServeOutput.stream; + Stream get pubServeStdOut => _pubServeStdOut.stream; + Stream get pubServeStdErr => _pubServeStdErr.stream; } diff --git a/lib/src/tasks/examples/cli.dart b/lib/src/tasks/examples/cli.dart index 60c48f07..31d0a31c 100644 --- a/lib/src/tasks/examples/cli.dart +++ b/lib/src/tasks/examples/cli.dart @@ -47,7 +47,8 @@ class ExamplesCli extends TaskCli { 'This project does not have any examples.'); ExamplesTask task = serveExamples(hostname: hostname, port: port); - reporter.logGroup(task.pubServeCommand, outputStream: task.pubServeOutput); + reporter.logGroup(task.pubServeCommand, + outputStream: task.pubServeStdOut, errorStream: task.pubServeStdErr); await task.done; reporter.logGroup(task.dartiumCommand, outputStream: task.dartiumOutput); return task.successful ? new CliResult.success() : new CliResult.fail();