| Index: utils/pub/source.dart
|
| diff --git a/utils/pub/source.dart b/utils/pub/source.dart
|
| index 211f0dbad4dc342350d9714ee83e5d18d38858f0..0db778299506c2b813b7c785f84a4fe737fa6e48 100644
|
| --- a/utils/pub/source.dart
|
| +++ b/utils/pub/source.dart
|
| @@ -9,6 +9,7 @@ import 'io.dart';
|
| import 'package.dart';
|
| import 'pubspec.dart';
|
| import 'system_cache.dart';
|
| +import 'utils.dart';
|
| import 'version.dart';
|
|
|
| /// A source from which to install packages.
|
| @@ -105,12 +106,14 @@ abstract class Source {
|
| /// By default, this uses [systemCacheDirectory] and [install].
|
| Future<Package> installToSystemCache(PackageId id) {
|
| var path = systemCacheDirectory(id);
|
| - return exists(path).then((exists) {
|
| - if (exists) return new Future<bool>.immediate(true);
|
| - return ensureDir(dirname(path)).then((_) => install(id, path));
|
| + // Make sure all errors propagate through future.
|
| + return defer(() {
|
| + if (entryExists(path)) return true;
|
| + ensureDir(dirname(path));
|
| + return install(id, path);
|
| }).then((found) {
|
| if (!found) throw 'Package $id not found.';
|
| - return Package.load(id.name, path, systemCache.sources);
|
| + return new Package(id.name, path, systemCache.sources);
|
| });
|
| }
|
|
|
|
|