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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 library pub.command.run;
2 import 'dart:async';
3 import 'package:path/path.dart' as p;
4 import '../command.dart';
5 import '../executable.dart';
6 import '../io.dart';
7 import '../utils.dart';
8 class RunCommand extends PubCommand {
9 bool get takesArguments => true;
10 bool get allowTrailingOptions => false;
11 String get description =>
12 "Run an executable from a package.\n"
13 "NOTE: We are currently optimizing this command's startup time.";
14 String get usage => "pub run <executable> [args...]";
15 Future onRun() {
16 final completer0 = new Completer();
17 scheduleMicrotask(() {
18 try {
19 join0() {
20 var package = entrypoint.root.name;
21 var executable = commandOptions.rest[0];
22 var args = commandOptions.rest.skip(1).toList();
23 join1() {
24 runExecutable(entrypoint, package, executable, args).then((x0) {
25 try {
26 var exitCode = x0;
27 flushThenExit(exitCode).then((x1) {
28 try {
29 x1;
30 completer0.complete(null);
31 } catch (e1) {
32 completer0.completeError(e1);
33 }
34 }, onError: (e2) {
35 completer0.completeError(e2);
36 });
37 } catch (e0) {
38 completer0.completeError(e0);
39 }
40 }, onError: (e3) {
41 completer0.completeError(e3);
42 });
43 }
44 if (executable.contains(":")) {
45 var components = split1(executable, ":");
46 package = components[0];
47 executable = components[1];
48 join2() {
49 join1();
50 }
51 if (p.split(executable).length > 1) {
52 usageError(
53 "Cannot run an executable in a subdirectory of a " + "dependen cy.");
54 join2();
55 } else {
56 join2();
57 }
58 } else {
59 join1();
60 }
61 }
62 if (commandOptions.rest.isEmpty) {
63 usageError("Must specify an executable to run.");
64 join0();
65 } else {
66 join0();
67 }
68 } catch (e4) {
69 completer0.completeError(e4);
70 }
71 });
72 return completer0.future;
73 }
74 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698