-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: un-deprecate
that_in_background()
.
In some configurations launchers may block, thus it's better to provide an easy mechanism to unblock an otherwise blocking call. This is alongside being able to use `command()` directly and simply spawn the command without waiting for it.
- Loading branch information
Showing
8 changed files
with
325 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[package] | ||
|
||
name = "open" | ||
version = "3.2.0" | ||
version = "3.3.0" | ||
authors = ["Sebastian Thiel <[email protected]>"] | ||
license = "MIT" | ||
edition = "2018" | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
use std::{ffi::OsStr, io, process::Command}; | ||
use std::{ffi::OsStr, process::Command}; | ||
|
||
use crate::{CommandExt, IntoResult}; | ||
|
||
pub fn that<T: AsRef<OsStr>>(path: T) -> io::Result<()> { | ||
Command::new("/bin/open") | ||
.arg(path.as_ref()) | ||
.status_without_output() | ||
.into_result() | ||
pub fn commands<T: AsRef<OsStr>>(path: T) -> Vec<Command> { | ||
let mut cmd = Command::new("/bin/open"); | ||
cmd.arg(path.as_ref()); | ||
vec![cmd] | ||
} | ||
|
||
pub fn with<T: AsRef<OsStr>>(path: T, app: impl Into<String>) -> io::Result<()> { | ||
Command::new(app.into()) | ||
.arg(path.as_ref()) | ||
.status_without_output() | ||
.into_result() | ||
pub fn with_command<T: AsRef<OsStr>>(path: T, app: impl Into<String>) -> Command { | ||
let mut cmd = Command::new(app.into()); | ||
cmd.arg(path.as_ref()); | ||
cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
use std::{ffi::OsStr, io, process::Command}; | ||
use std::{ffi::OsStr, process::Command}; | ||
|
||
use crate::{CommandExt, IntoResult}; | ||
|
||
pub fn that<T: AsRef<OsStr>>(path: T) -> io::Result<()> { | ||
Command::new("uiopen") | ||
.arg("--url") | ||
.arg(path.as_ref()) | ||
.status_without_output() | ||
.into_result() | ||
pub fn commands<T: AsRef<OsStr>>(path: T) -> Vec<Command> { | ||
let mut cmd = Command::new("uiopen"); | ||
cmd.arg("--url").arg(path.as_ref()); | ||
vec![cmd] | ||
} | ||
|
||
pub fn with<T: AsRef<OsStr>>(path: T, app: impl Into<String>) -> io::Result<()> { | ||
Command::new("uiopen") | ||
.arg("--url") | ||
pub fn with_command<T: AsRef<OsStr>>(path: T, app: impl Into<String>) -> Command { | ||
let mut cmd = Command::new("uiopen"); | ||
cmd.arg("--url") | ||
.arg(path.as_ref()) | ||
.arg("--bundleid") | ||
.arg(app.into()) | ||
.status_without_output() | ||
.into_result() | ||
.arg(app.into()); | ||
cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,13 @@ | ||
use std::{ffi::OsStr, io, process::Command}; | ||
use std::{ffi::OsStr, process::Command}; | ||
|
||
use crate::{CommandExt, IntoResult}; | ||
|
||
pub fn that<T: AsRef<OsStr>>(path: T) -> io::Result<()> { | ||
Command::new("/usr/bin/open") | ||
.arg(path.as_ref()) | ||
.status_without_output() | ||
.into_result() | ||
pub fn commands<T: AsRef<OsStr>>(path: T) -> Vec<Command> { | ||
let mut cmd = Command::new("/usr/bin/open"); | ||
cmd.arg(path.as_ref()); | ||
vec![cmd] | ||
} | ||
|
||
pub fn with<T: AsRef<OsStr>>(path: T, app: impl Into<String>) -> io::Result<()> { | ||
Command::new("/usr/bin/open") | ||
.arg(path.as_ref()) | ||
.arg("-a") | ||
.arg(app.into()) | ||
.status_without_output() | ||
.into_result() | ||
pub fn with_command<T: AsRef<OsStr>>(path: T, app: impl Into<String>) -> Command { | ||
let mut cmd = Command::new("/usr/bin/open"); | ||
cmd.arg(path.as_ref()).arg("-a").arg(app.into()); | ||
cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,13 @@ | ||
use std::{ffi::OsStr, io}; | ||
use std::{ffi::OsStr, process::Command}; | ||
|
||
use crate::{CommandExt, IntoResult}; | ||
|
||
pub fn that<T: AsRef<OsStr>>(path: T) -> io::Result<()> { | ||
std::process::Command::new("cmd") | ||
.arg("/c") | ||
.arg("start") | ||
.arg(path.as_ref()) | ||
.status_without_output() | ||
.into_result() | ||
pub fn commands<T: AsRef<OsStr>>(path: T) -> Vec<Command> { | ||
let mut cmd = Command::new("cmd"); | ||
cmd.arg("/c").arg("start").arg(path.as_ref()); | ||
vec![cmd] | ||
} | ||
|
||
pub fn with<T: AsRef<OsStr>>(path: T, app: impl Into<String>) -> io::Result<()> { | ||
std::process::Command::new("cmd") | ||
.arg("/c") | ||
.arg(app.into()) | ||
.arg(path.as_ref()) | ||
.status_without_output() | ||
.into_result() | ||
pub fn with_command<T: AsRef<OsStr>>(path: T, app: impl Into<String>) -> Command { | ||
let mut cmd = Command::new("cmd"); | ||
cmd.arg("/c").arg(app.into()).arg(path.as_ref()); | ||
cmd | ||
} |