Skip to content

Commit

Permalink
fix: deprecate that_in_background() as that() is definitely non-b…
Browse files Browse the repository at this point in the history
…locking now.

Note that we keep `with_in_background()` as it's unclear if a custom
launcher blocks or not.
  • Loading branch information
Byron committed Jun 12, 2022
1 parent 3f51fb2 commit df358d2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,18 @@ pub fn with<T: AsRef<OsStr>>(path: T, app: impl Into<String>) -> io::Result<()>
os::with(path, app)
}

/// Open path with the default application in a new thread, which is useful if
/// the program ends up to be blocking. Otherwise, prefer [`that()`].
/// Open path with the default application in a new thread.
///
/// See documentation of [`that()`] for more details.
#[deprecated = "Use `that()` as it is non-blocking while making error handling easy."]
pub fn that_in_background<T: AsRef<OsStr>>(path: T) -> thread::JoinHandle<io::Result<()>> {
let path = path.as_ref().to_os_string();
thread::spawn(|| that(path))
}

/// Open path with the given application in a new thread.
/// Open path with the given application in a new thread, which is useful if
/// the program ends up to be blocking. Otherwise, prefer [`with()`] for
/// straightforward error handling.
///
/// See documentation of [`with()`] for more details.
pub fn with_in_background<T: AsRef<OsStr>>(
Expand Down

0 comments on commit df358d2

Please sign in to comment.