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

Unified Diff: utils/pub/pub.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « utils/pub/package.dart ('k') | utils/pub/pubspec.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/pub.dart
diff --git a/utils/pub/pub.dart b/utils/pub/pub.dart
index 6fcecd95885b3c583f4b0e9ccfbd61d2b37c1725..1a8642e7bdb7e46b7bca758c0c636784d87576c3 100644
--- a/utils/pub/pub.dart
+++ b/utils/pub/pub.dart
@@ -5,6 +5,7 @@
/// The main entrypoint for the pub command line application.
library pub;
+import 'dart:async';
import '../../pkg/args/lib/args.dart';
import '../../pkg/path/lib/path.dart' as path;
import 'dart:io';
@@ -244,7 +245,7 @@ abstract class PubCommand {
future = Entrypoint.load(path.current, cache);
}
- future = future.chain((entrypoint) {
+ future = future.then((entrypoint) {
this.entrypoint = entrypoint;
try {
var commandFuture = onRun();
@@ -257,23 +258,24 @@ abstract class PubCommand {
}
});
- future = future.chain((_) => cache_.deleteTempDir());
- future.handleException((e) {
- if (e is PubspecNotFoundException && e.name == null) {
- e = 'Could not find a file named "pubspec.yaml" in the directory '
- '${path.current}.';
- } else if (e is PubspecHasNoNameException && e.name == null) {
- e = 'pubspec.yaml is missing the required "name" field (e.g. "name: '
- '${basename(path.current)}").';
- }
-
- handleError(e, future.stackTrace);
- });
-
- // Explicitly exit on success to ensure that any dangling dart:io handles
- // don't cause the process to never terminate.
- future.then((_) => exit(0));
+ future
+ .then((_) => cache_.deleteTempDir())
+ .catchError((error) {
+ var e = error.error;
+ if (e is PubspecNotFoundException && e.name == null) {
+ e = 'Could not find a file named "pubspec.yaml" in the directory '
+ '${path.current}.';
+ } else if (e is PubspecHasNoNameException && e.name == null) {
+ e = 'pubspec.yaml is missing the required "name" field (e.g. "name: '
+ '${basename(path.current)}").';
+ }
+
+ handleError(e, error.stackTrace);
+ })
+ // Explicitly exit on success to ensure that any dangling dart:io handles
+ // don't cause the process to never terminate.
+ .then((_) => exit(0));
}
/// Override this to perform the specific command. Return a future that
« no previous file with comments | « utils/pub/package.dart ('k') | utils/pub/pubspec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698