From d136c3a7c67a7d9554b97ac85f427aa37edeab96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matou=C5=A1=20Dzivjak?= Date: Sun, 5 Feb 2023 19:02:05 +0000 Subject: [PATCH] try commands without args --- src/unix.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/unix.rs b/src/unix.rs index 14bbca7..044b63f 100644 --- a/src/unix.rs +++ b/src/unix.rs @@ -11,17 +11,15 @@ use crate::{CommandExt, IntoResult}; pub fn command>(path: T) -> Command { let path = path.as_ref(); let open_handlers = [ - ("xdg-open", &["--version"], &[path] as &[_]), - ("gio", &["version"], &[OsStr::new("open"), path]), - ("gnome-open", &["--version"], &[path]), - ("kde-open", &["--version"], &[path]), - ("wslview", &["--version"], &[&wsl_path(path)]), + ("xdg-open", &[path] as &[_]), + ("gio", &[OsStr::new("open"), path]), + ("gnome-open", &[path]), + ("kde-open", &[path]), + ("wslview", &[&wsl_path(path)]), ]; - for (command, check_args, args) in &open_handlers { - let result = Command::new(command) - .args(*check_args) - .status_without_output(); + for (command, args) in &open_handlers { + let result = Command::new(command).status_without_output(); if let Ok(status) = result { if status.success() { @@ -33,7 +31,7 @@ pub fn command>(path: T) -> Command { } // fallback to xdg-open - let (command, _, args) = &open_handlers[0]; + let (command, args) = &open_handlers[0]; let mut cmd = Command::new(command); cmd.args(*args); cmd