Add kill option to fargo run and fix threads
Useful for repeated testing of apps that run on the frame buffer,
since only one such app can be run at a time.
Also stopped passing threads as an option, as it now expects a number and I have no idea what that should be. Hopefully rustc will pick a good one.
Change-Id: I791be59cdb535fead8b3a54e5287085e891827c4
Reviewed-on: https://fuchsia-review.googlesource.com/c/fargo/+/423832
Reviewed-by: Dan Johnson <computerdruid@google.com>
diff --git a/src/command_line.rs b/src/command_line.rs
index 179bab1..8e54229 100644
--- a/src/command_line.rs
+++ b/src/command_line.rs
@@ -189,6 +189,10 @@
#[structopt(long)]
run_with_sessionctl: bool,
+ /// Use Use sessionctl to run the binary.
+ #[structopt(short = "K", long)]
+ kill_all: bool,
+
/// Directory of app as it appears in the manifest file.
#[structopt(long, default_value = "bin")]
app_dir: String,
@@ -561,6 +565,11 @@
FargoCommand::Run(run) => {
let mut params = vec![];
+ if run.kill_all {
+ ssh(opt.verbose, &fuchsia_config, &target_options, "killall *fargo.cmx")
+ .unwrap_or_default();
+ }
+
if let Some(package) = run.package.as_ref() {
params.push("--package");
params.push(package);
diff --git a/src/lib.rs b/src/lib.rs
index 23f13f0..f704c3d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -359,7 +359,6 @@
// http://fuchsia.googlesource.com/fuchsia/+/08dce526941ac5be23cec1b50f841aad5ed37ea1/build/config/BUILD.gn#547
"--cfg=rust_panic=\"abort\"".to_string(),
"-Clink-arg=--pack-dyn-relocs=relr".to_string(),
- "-Clink-arg=--threads".to_string(),
format!("-Clink-arg=-L{}", sysroot_lib),
format!("-Clink-arg=-L{}/gen/zircon/public/lib/fdio", shared_lib_path.to_string_lossy(),),
format!("-Clink-arg=-L{}/gen/zircon/public/lib/syslog", shared_lib_path.to_string_lossy(),),