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

Unified Diff: utils/pub/io.dart

Issue 11170003: Pub fix for Windows (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 8 years, 2 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
« utils/pub/hosted_source.dart ('K') | « utils/pub/hosted_source.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
}
/**
« utils/pub/hosted_source.dart ('K') | « utils/pub/hosted_source.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698