Chromium Code Reviews| Index: utils/pub/io.dart |
| diff --git a/utils/pub/io.dart b/utils/pub/io.dart |
| index 6e45a7412a1f26eb3c378f1f10d10c14097e5f5a..c5f64c6bd0b237dbe0c653bb96c56a3d14890428 100644 |
| --- a/utils/pub/io.dart |
| +++ b/utils/pub/io.dart |
| @@ -685,7 +685,13 @@ Future<bool> _extractTarGzWindows(InputStream stream, String destination) { |
| // Write the archive to a temp file. |
| tempDir = temp; |
| return createFileFromStream(stream, join(tempDir, 'data.tar.gz')); |
| - }).chain((tarGz) { |
| + }).chain((_) { |
| + // TODO(rnystrom): Hack. We get intermittent "file already in use" errors. |
|
kasperl
2012/10/16 05:44:46
This smells like a dart:io issue. Did you file a b
|
| + // It looks like the 7zip process is starting up before the file has |
| + // finished being written. So we'll just sleep for a couple of seconds |
| + // here. :( |
| + return sleep(2000); |
| + }).chain((_) { |
| // 7zip can't unarchive from gzip -> tar -> destination all in one step |
| // first we un-gzip it to a tar file. |
| // Note: Setting the working directory instead of passing in a full file |
| @@ -697,7 +703,6 @@ Future<bool> _extractTarGzWindows(InputStream stream, String destination) { |
| '${Strings.join(result.stdout, "\n")}\n' |
| '${Strings.join(result.stderr, "\n")}'; |
| } |
| - |
| // Find the tar file we just created since we don't know its name. |
| return listDir(tempDir); |
| }).chain((files) { |
| @@ -717,6 +722,7 @@ Future<bool> _extractTarGzWindows(InputStream stream, String destination) { |
| }).chain((result) { |
| if (result.exitCode != 0) { |
| throw 'Could not un-tar (exit code ${result.exitCode}). Error:\n' |
| + '${Strings.join(result.stdout, "\n")}\n' |
| '${Strings.join(result.stderr, "\n")}'; |
| } |