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

Unified Diff: sdk/lib/_internal/pub_generated/lib/src/command/global_run.dart

Issue 557563002: Store the async-await compiled pub code directly in the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
Index: sdk/lib/_internal/pub_generated/lib/src/command/global_run.dart
diff --git a/sdk/lib/_internal/pub_generated/lib/src/command/global_run.dart b/sdk/lib/_internal/pub_generated/lib/src/command/global_run.dart
new file mode 100644
index 0000000000000000000000000000000000000000..6fffe0f4aaa74331c1bc316654a68431461533c5
--- /dev/null
+++ b/sdk/lib/_internal/pub_generated/lib/src/command/global_run.dart
@@ -0,0 +1,74 @@
+library pub.command.global_run;
+import 'dart:async';
+import 'package:path/path.dart' as p;
+import '../command.dart';
+import '../io.dart';
+import '../utils.dart';
+class GlobalRunCommand extends PubCommand {
+ bool get takesArguments => true;
+ bool get allowTrailingOptions => false;
+ String get description =>
+ "Run an executable from a globally activated package.\n"
+ "NOTE: We are currently optimizing this command's startup time.";
+ String get usage => "pub global run <package>:<executable> [args...]";
+ Future onRun() {
+ final completer0 = new Completer();
+ scheduleMicrotask(() {
+ try {
+ join0() {
+ var package;
+ var executable = commandOptions.rest[0];
+ join1() {
+ var args = commandOptions.rest.skip(1).toList();
+ join2() {
+ globals.runExecutable(package, executable, args).then((x0) {
+ try {
+ var exitCode = x0;
+ flushThenExit(exitCode).then((x1) {
+ try {
+ x1;
+ completer0.complete(null);
+ } catch (e1) {
+ completer0.completeError(e1);
+ }
+ }, onError: (e2) {
+ completer0.completeError(e2);
+ });
+ } catch (e0) {
+ completer0.completeError(e0);
+ }
+ }, onError: (e3) {
+ completer0.completeError(e3);
+ });
+ }
+ if (p.split(executable).length > 1) {
+ usageError(
+ 'Cannot run an executable in a subdirectory of a global ' + 'package.');
+ join2();
+ } else {
+ join2();
+ }
+ }
+ if (executable.contains(":")) {
+ var parts = split1(executable, ":");
+ package = parts[0];
+ executable = parts[1];
+ join1();
+ } else {
+ package = executable;
+ join1();
+ }
+ }
+ if (commandOptions.rest.isEmpty) {
+ usageError("Must specify an executable to run.");
+ join0();
+ } else {
+ join0();
+ }
+ } catch (e4) {
+ completer0.completeError(e4);
+ }
+ });
+ return completer0.future;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698