Chromium Code Reviews| Index: utils/pub/io.dart |
| diff --git a/utils/pub/io.dart b/utils/pub/io.dart |
| index c5f64c6bd0b237dbe0c653bb96c56a3d14890428..805227bac6c50bac157d9b3ec4c1551d90559eef 100644 |
| --- a/utils/pub/io.dart |
| +++ b/utils/pub/io.dart |
| @@ -499,50 +499,10 @@ Future<PubProcessResult> runProcess(String executable, List<String> args, |
| } |
| options.environment = environment; |
| - final process = Process.start(executable, args, options); |
| - |
| - final outStream = new StringInputStream(process.stdout); |
| - final processStdout = <String>[]; |
| - |
| - final errStream = new StringInputStream(process.stderr); |
| - final processStderr = <String>[]; |
| - |
| - final completer = new Completer<PubProcessResult>(); |
| - |
| - checkComplete() { |
| - // Wait until the process is done and its output streams are closed. |
| - if (!pipeStdout && !outStream.closed) return; |
| - if (!pipeStderr && !errStream.closed) return; |
| - if (exitCode == null) return; |
| - |
| - completer.complete(new PubProcessResult( |
| - processStdout, processStderr, exitCode)); |
| - } |
| - |
| - if (pipeStdout) { |
| - process.stdout.pipe(stdout, close: false); |
| - } else { |
| - outStream.onLine = () => processStdout.add(outStream.readLine()); |
| - outStream.onClosed = checkComplete; |
| - outStream.onError = (error) => completer.completeException(error); |
| - } |
| - |
| - if (pipeStderr) { |
| - process.stderr.pipe(stderr, close: false); |
| - } else { |
| - errStream.onLine = () => processStderr.add(errStream.readLine()); |
| - errStream.onClosed = checkComplete; |
| - errStream.onError = (error) => completer.completeException(error); |
| - } |
| - |
| - process.onExit = (actualExitCode) { |
| - exitCode = actualExitCode; |
| - checkComplete(); |
| - }; |
| - |
| - process.onError = (error) => completer.completeException(error); |
| - |
| - return completer.future; |
| + var future = Process.run(executable, args, options); |
| + return future.transform((result) { |
| + return new PubProcessResult(result.stdout, result.stderr, result.exitCode); |
| + }); |
|
Bob Nystrom
2012/10/16 14:07:29
Well this is a distinct improvement. :)
This code
Anders Johnsen
2012/10/16 14:29:57
There is nothing wrong with the old code, other th
nweiz
2012/10/16 17:20:15
This doesn't support pipeStdout/pipeStderr. Either
Anders Johnsen
2012/10/17 07:05:25
Ahh, good point. Bob, is the piping needed in Pub?
Bob Nystrom
2012/10/17 16:25:52
It doesn't look like we're using that right now, s
|
| } |
| /** |