diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-02-16 22:05:37 -0500 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-02-16 22:05:37 -0500 |
commit | cda3f32b6ce5f2404bd80f878d1e03982aa3d749 (patch) | |
tree | fab01ea268cf500eac56950749e54e26d197847c /src/unix.rs | |
parent | 130f54a49ca0a9852c488b7583d6cdf053855263 (diff) |
fix open_with adding program name as argument
Diffstat (limited to 'src/unix.rs')
-rw-r--r-- | src/unix.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/unix.rs b/src/unix.rs index 8a19216..9e402d8 100644 --- a/src/unix.rs +++ b/src/unix.rs @@ -96,6 +96,10 @@ pub fn open_with_entry(paths: &[PathBuf], entry: &mimetype::JoshutoMimetypeEntry let program = entry.program.clone(); let mut command = process::Command::new(program); + if let Some(true) = entry.silent { + command.stdout(process::Stdio::null()); + command.stderr(process::Stdio::null()); + } if let Some(args) = entry.args.as_ref() { for arg in args { command.arg(arg.clone()); @@ -104,10 +108,6 @@ pub fn open_with_entry(paths: &[PathBuf], entry: &mimetype::JoshutoMimetypeEntry for path in paths { command.arg(path.as_os_str()); } - if let Some(true) = entry.silent { - command.stdout(process::Stdio::null()); - command.stderr(process::Stdio::null()); - } match command.spawn() { Ok(mut handle) => { @@ -127,7 +127,7 @@ pub fn open_with_args(paths: &[PathBuf], args: &[String]) { let program = args[0].clone(); let mut command = process::Command::new(program); - for arg in args { + for arg in &args[1..] { command.arg(arg.clone()); } for path in paths { |