Chromium Code Reviews| 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); |
| } |