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

Unified Diff: utils/pub/hosted_source.dart

Issue 10970025: Beat on hosted repo support on Windows a bit more. (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/pub/io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/hosted_source.dart
diff --git a/utils/pub/hosted_source.dart b/utils/pub/hosted_source.dart
index 1d9a8477ce0b8baf93d4f33467d9f02345cba897..37ad288e1f65c30be8767e41737e3e8d76799430 100644
--- a/utils/pub/hosted_source.dart
+++ b/utils/pub/hosted_source.dart
@@ -4,8 +4,10 @@
#library('hosted_source');
+#import('dart:io', prefix: 'io');
#import('dart:json');
#import('dart:uri');
+
#import('io.dart');
#import('package.dart');
#import('pubspec.dart');
@@ -70,9 +72,19 @@ class HostedSource extends Source {
var url = parsedDescription.last;
var fullUrl = "$url/packages/$name/versions/${id.version}.tar.gz";
+
return Futures.wait([httpGet(fullUrl), ensureDir(destPath)]).chain((args) {
return timeout(extractTarGz(args[0], args[1]), HTTP_TIMEOUT,
'Timed out while fetching URL "$fullUrl".');
+ }).transformException((ex) {
+ // If the install failed, delete the directory. Prevents leaving a ghost
+ // directory in the system cache which would later make pub think the
+ // install succeeded.
+ // TODO(rnystrom): Use deleteDir() here when transformException() supports
+ // returning a future. Also remove dart:io import then.
+ new io.Directory(destPath).deleteRecursivelySync();
+
+ throw ex;
});
}
« no previous file with comments | « no previous file | utils/pub/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698