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

Unified Diff: utils/pub/entrypoint.dart

Issue 11477012: Workaround #6986. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/entrypoint.dart
diff --git a/utils/pub/entrypoint.dart b/utils/pub/entrypoint.dart
index d2b738e4eee053baa23214dff34d02820257d8e5..56007e0fe78dd90ab32c0a88af95cdaae972a4be 100644
--- a/utils/pub/entrypoint.dart
+++ b/utils/pub/entrypoint.dart
@@ -167,29 +167,18 @@ class Entrypoint {
* warning message and act as though the file doesn't exist.
*/
Future<LockFile> _loadLockFile() {
- var completer = new Completer<LockFile>();
var lockFilePath = join(root.dir, 'pubspec.lock');
log.fine("Loading lockfile.");
- var future = readTextFile(lockFilePath);
-
- future.handleException((_) {
- // If we failed to load the lockfile but it does exist, something's
- // probably wrong and we should notify the user.
- fileExists(lockFilePath).transform((exists) {
- if (!exists) return;
- log.error("Error reading pubspec.lock: ${future.exception}");
- }).then((_) {
+ return fileExists(lockFilePath).chain((exists) {
+ if (!exists) {
log.fine("No lock file at $lockFilePath, creating empty one.");
- completer.complete(new LockFile.empty());
- });
+ return new Future<LockFile>.immediate(new LockFile.empty());
+ }
- return true;
+ return readTextFile(lockFilePath).transform((text) =>
+ new LockFile.parse(text, cache.sources));
});
-
- future.then((text) =>
- completer.complete(new LockFile.parse(text, cache.sources)));
- return completer.future;
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698