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

Unified Diff: sdk/lib/_internal/pub_generated/lib/src/command/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/run.dart
diff --git a/sdk/lib/_internal/pub_generated/lib/src/command/run.dart b/sdk/lib/_internal/pub_generated/lib/src/command/run.dart
new file mode 100644
index 0000000000000000000000000000000000000000..0cb0064b727f2b45594fe11c6c8bf4311b9dd246
--- /dev/null
+++ b/sdk/lib/_internal/pub_generated/lib/src/command/run.dart
@@ -0,0 +1,74 @@
+library pub.command.run;
+import 'dart:async';
+import 'package:path/path.dart' as p;
+import '../command.dart';
+import '../executable.dart';
+import '../io.dart';
+import '../utils.dart';
+class RunCommand extends PubCommand {
+ bool get takesArguments => true;
+ bool get allowTrailingOptions => false;
+ String get description =>
+ "Run an executable from a package.\n"
+ "NOTE: We are currently optimizing this command's startup time.";
+ String get usage => "pub run <executable> [args...]";
+ Future onRun() {
+ final completer0 = new Completer();
+ scheduleMicrotask(() {
+ try {
+ join0() {
+ var package = entrypoint.root.name;
+ var executable = commandOptions.rest[0];
+ var args = commandOptions.rest.skip(1).toList();
+ join1() {
+ runExecutable(entrypoint, 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 (executable.contains(":")) {
+ var components = split1(executable, ":");
+ package = components[0];
+ executable = components[1];
+ join2() {
+ join1();
+ }
+ if (p.split(executable).length > 1) {
+ usageError(
+ "Cannot run an executable in a subdirectory of a " + "dependency.");
+ join2();
+ } else {
+ join2();
+ }
+ } else {
+ 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