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

Unified Diff: lib/src/executable.dart

Issue 1272813003: Support "--checked" in pub run and global run. (Closed) Base URL: https://github.com/dart-lang/pub.git@master
Patch Set: Revise. Created 5 years, 4 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 | « lib/src/command/run.dart ('k') | lib/src/global_packages.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/executable.dart
diff --git a/lib/src/executable.dart b/lib/src/executable.dart
index 62c33a1c6c1499296c65354e5990e7c0bbe735a7..2a9873c5e22132f86c5079baaf144ae6b249b332 100644
--- a/lib/src/executable.dart
+++ b/lib/src/executable.dart
@@ -44,13 +44,13 @@ final _catchableSignals = Platform.isWindows
///
/// Arguments from [args] will be passed to the spawned Dart application.
///
-/// If [mode] is passed, it's used as the barback mode; it defaults to
-/// [BarbackMode.RELEASE].
+/// If [checked] is true, the program is run in checked mode. If [mode] is
+/// passed, it's used as the barback mode; it defaults to [BarbackMode.RELEASE].
///
/// Returns the exit code of the spawned app.
Future<int> runExecutable(Entrypoint entrypoint, String package,
String executable, Iterable<String> args, {bool isGlobal: false,
- BarbackMode mode}) async {
+ bool checked: false, BarbackMode mode}) async {
if (mode == null) mode = BarbackMode.RELEASE;
// Make sure the package is an immediate dependency of the entrypoint or the
@@ -84,7 +84,8 @@ Future<int> runExecutable(Entrypoint entrypoint, String package,
// default mode for them to run. We can't run them in a different mode
// using the snapshot.
mode == BarbackMode.RELEASE) {
- return _runCachedExecutable(entrypoint, localSnapshotPath, args);
+ return _runCachedExecutable(entrypoint, localSnapshotPath, args,
+ checked: checked);
}
// If the command has a path separator, then it's a path relative to the
@@ -95,8 +96,7 @@ Future<int> runExecutable(Entrypoint entrypoint, String package,
var vmArgs = [];
// Run in checked mode.
- // TODO(rnystrom): Make this configurable.
- vmArgs.add("--checked");
+ if (checked) vmArgs.add("--checked");
var executableUrl = await _executableUrl(
entrypoint, package, executable, isGlobal: isGlobal, mode: mode);
@@ -268,8 +268,8 @@ void _forwardSignals(Process process) {
/// Runs the executable snapshot at [snapshotPath].
Future<int> _runCachedExecutable(Entrypoint entrypoint, String snapshotPath,
- List<String> args) {
- return runSnapshot(snapshotPath, args, checked: true, recompile: () {
+ List<String> args, {bool checked: false}) {
+ return runSnapshot(snapshotPath, args, checked: checked, recompile: () {
log.fine("Precompiled executable is out of date.");
return entrypoint.precompileExecutables();
});
« no previous file with comments | « lib/src/command/run.dart ('k') | lib/src/global_packages.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698