Prechádzať zdrojové kódy

Make the runner argument optional to let it run on a machine without sudo

niels 2 rokov pred
rodič
commit
c1dab14e45
1 zmenil súbory, kde vykonal 6 pridanie a 3 odobranie
  1. 6 3
      xtask/src/run.rs

+ 6 - 3
xtask/src/run.rs

@@ -14,8 +14,8 @@ pub struct Options {
     #[clap(long)]
     pub release: bool,
     /// The command used to wrap your application
-    #[clap(short, long, default_value = "sudo -E")] // TODO: Portable solution
-    pub runner: String,
+    #[clap(short, long)]
+    pub runner: Option<String>,
     /// Arguments to pass to your application
     #[clap(name = "args", last = true)]
     pub run_args: Vec<String>,
@@ -53,7 +53,10 @@ pub fn run(opts: Options) -> Result<(), anyhow::Error> {
     let mut run_args: Vec<_> = opts.run_args.iter().map(String::as_str).collect();
 
     // configure args
-    let mut args: Vec<_> = opts.runner.trim().split_terminator(' ').collect();
+    let mut args: Vec<_> = Vec::new();
+    if let Some(s) = opts.runner.as_deref() {
+        args.extend(s.trim().split_terminator(' '));
+    };
     args.push(bin_path.as_str());
     args.append(&mut run_args);