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

Unified Diff: utils/pub/io.dart

Issue 10947031: Fix use of Process API in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | utils/tests/pub/pub.status » ('j') | 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 122e463027bb0b3a3c592078aaf6db1d31890ea0..3f281d6fb1b2cec792c963dd39055c46be9b2da8 100644
--- a/utils/pub/io.dart
+++ b/utils/pub/io.dart
@@ -381,10 +381,7 @@ Future<InputStream> httpGet(uri) {
return;
}
- // TODO(nweiz): remove this extra pipe when issue 4974 is fixed.
- var sink = new ListInputStream();
- pipeInputToInput(response.inputStream, sink);
- completer.complete(sink);
+ completer.complete(response.inputStream);
};
return completer.future;
@@ -586,12 +583,17 @@ Future<bool> extractTarGz(InputStream stream, destination) {
["--extract", "--gunzip", "--directory", _getPath(destination)]);
var completer = new Completer<int>();
- stream.pipe(process.stdin);
- process.stdout.pipe(stdout, close: false);
- process.stderr.pipe(stderr, close: false);
+ // Wait for the process to be fully started before writing to its
+ // stdin stream.
+ process.onStart = () {
+ stream.pipe(process.stdin);
+ process.stdout.pipe(stdout, close: false);
+ process.stderr.pipe(stderr, close: false);
+
+ process.onExit = completer.complete;
+ process.onError = completer.completeException;
nweiz 2012/09/19 18:09:45 What happens if "tar" isn't found? Will onStart fi
Mads Ager (google) 2012/09/20 06:16:26 Good catch, thanks! If the executable is not found
+ };
- process.onExit = completer.complete;
- process.onError = completer.completeException;
return completer.future.transform((exitCode) => exitCode == 0);
}
« no previous file with comments | « no previous file | utils/tests/pub/pub.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698