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

Unified Diff: sdk/lib/_internal/pub/lib/src/executable.dart

Issue 868463003: Regenerate pub's sources and remove workarounds for fixed issues. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 5 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 | « sdk/lib/_internal/pub/lib/src/entrypoint.dart ('k') | sdk/lib/_internal/pub/lib/src/global_packages.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/executable.dart
diff --git a/sdk/lib/_internal/pub/lib/src/executable.dart b/sdk/lib/_internal/pub/lib/src/executable.dart
index 38105925f88befd4f655776caada5d51c17d5710..966b68f6d7f6efb6b980c407cc3d531ad787f646 100644
--- a/sdk/lib/_internal/pub/lib/src/executable.dart
+++ b/sdk/lib/_internal/pub/lib/src/executable.dart
@@ -106,32 +106,9 @@ Future<int> runExecutable(Entrypoint entrypoint, String package,
server = await environment.servePackageBinDirectory(package);
}
- // TODO(rnystrom): Use try/catch here when
- // https://github.com/dart-lang/async_await/issues/4 is fixed.
- return environment.barback.getAssetById(id).then((_) async {
- var vmArgs = [];
-
- // Run in checked mode.
- // TODO(rnystrom): Make this configurable.
- vmArgs.add("--checked");
-
- // Get the URL of the executable, relative to the server's root directory.
- var relativePath = p.url.relative(assetPath,
- from: p.url.joinAll(p.split(server.rootDirectory)));
- vmArgs.add(server.url.resolve(relativePath).toString());
- vmArgs.addAll(args);
-
- var process = await Process.start(Platform.executable, vmArgs);
- // Note: we're not using process.std___.pipe(std___) here because
- // that prevents pub from also writing to the output streams.
- process.stderr.listen(stderr.add);
- process.stdout.listen(stdout.add);
- stdin.listen(process.stdin.add);
-
- return process.exitCode;
- }).catchError((error, stackTrace) {
- if (error is! AssetNotFoundException) throw error;
-
+ try {
+ await environment.barback.getAssetById(id);
+ } on AssetNotFoundException catch (error, stackTrace) {
var message = "Could not find ${log.bold(executable + ".dart")}";
if (package != entrypoint.root.name) {
message += " in package ${log.bold(server.package)}";
@@ -140,7 +117,28 @@ Future<int> runExecutable(Entrypoint entrypoint, String package,
log.error("$message.");
log.fine(new Chain.forTrace(stackTrace));
return exit_codes.NO_INPUT;
- });
+ }
+
+ var vmArgs = [];
+
+ // Run in checked mode.
+ // TODO(rnystrom): Make this configurable.
+ vmArgs.add("--checked");
+
+ // Get the URL of the executable, relative to the server's root directory.
+ var relativePath = p.url.relative(assetPath,
+ from: p.url.joinAll(p.split(server.rootDirectory)));
+ vmArgs.add(server.url.resolve(relativePath).toString());
+ vmArgs.addAll(args);
+
+ var process = await Process.start(Platform.executable, vmArgs);
+ // Note: we're not using process.std___.pipe(std___) here because
+ // that prevents pub from also writing to the output streams.
+ process.stderr.listen(stderr.add);
+ process.stdout.listen(stdout.add);
+ stdin.listen(process.stdin.add);
+
+ return process.exitCode;
}
/// Runs the snapshot at [path] with [args] and hooks its stdout, stderr, and
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/entrypoint.dart ('k') | sdk/lib/_internal/pub/lib/src/global_packages.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698