diff --git a/src/haiku.rs b/src/haiku.rs index 4f7a599..7ffb4f2 100644 --- a/src/haiku.rs +++ b/src/haiku.rs @@ -8,11 +8,6 @@ pub fn commands>(path: T) -> Vec { vec![cmd] } -pub fn that>(path: T) -> io::Result<()> { - let cmd = &mut commands(path)[0]; - cmd.status_without_output().into_result(cmd) -} - pub fn with>(path: T, app: impl Into) -> io::Result<()> { let mut cmd = Command::new(app.into()); cmd.arg(path.as_ref()) diff --git a/src/ios.rs b/src/ios.rs index ce1f8ef..2b4d3b3 100644 --- a/src/ios.rs +++ b/src/ios.rs @@ -8,11 +8,6 @@ pub fn commands>(path: T) -> Vec { vec![cmd] } -pub fn that>(path: T) -> io::Result<()> { - let cmd = &mut commands(path)[0]; - cmd.status_without_output().into_result(cmd) -} - pub fn with>(path: T, app: impl Into) -> io::Result<()> { let mut cmd = Command::new("uiopen"); cmd.arg("--url") diff --git a/src/lib.rs b/src/lib.rs index 3255bf4..9b02c0b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -114,7 +114,16 @@ use std::{ /// Sometimes, depending on the platform and system configuration, launchers *can* block. /// If you want to be sure they don't, use [`that_in_background()`] instead. pub fn that>(path: T) -> io::Result<()> { - os::that(path) + let mut last_err = None; + for mut cmd in commands(path) { + match cmd.status_without_output() { + Ok(status) => { + return Ok(status).into_result(&cmd); + } + Err(err) => last_err = Some(err), + } + } + Err(last_err.expect("no launcher worked, at least one error")) } /// Open path with the given application. diff --git a/src/macos.rs b/src/macos.rs index 000416c..8080325 100644 --- a/src/macos.rs +++ b/src/macos.rs @@ -8,11 +8,6 @@ pub fn commands>(path: T) -> Vec { vec![cmd] } -pub fn that>(path: T) -> io::Result<()> { - let cmd = &mut commands(path)[0]; - cmd.status_without_output().into_result(cmd) -} - pub fn with>(path: T, app: impl Into) -> io::Result<()> { let mut cmd = Command::new("/usr/bin/open"); cmd.arg(path.as_ref()) diff --git a/src/unix.rs b/src/unix.rs index bfd9f84..f103d1d 100644 --- a/src/unix.rs +++ b/src/unix.rs @@ -26,19 +26,6 @@ pub fn commands>(path: T) -> Vec { .collect() } -pub fn that>(path: T) -> io::Result<()> { - let mut last_err = None; - for mut cmd in commands(path) { - match cmd.status_without_output() { - Ok(status) => { - return Ok(status).into_result(&cmd); - } - Err(err) => last_err = Some(err), - } - } - Err(last_err.expect("no launcher worked, at least one error")) -} - pub fn with>(path: T, app: impl Into) -> io::Result<()> { let mut cmd = Command::new(app.into()); cmd.arg(path.as_ref()) diff --git a/src/windows.rs b/src/windows.rs index bf3dc15..990ff51 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -8,11 +8,6 @@ pub fn commands>(path: T) -> Vec { vec![cmd] } -pub fn that>(path: T) -> io::Result<()> { - let cmd = &mut commands(path)[0]; - cmd.status_without_output().into_result(cmd) -} - pub fn with>(path: T, app: impl Into) -> io::Result<()> { let mut cmd = Command::new("cmd"); cmd.arg("/c")