switch from open to opener

By default, `opener` launches the subprocess without waiting for its
completion, compared to `open` which waits for its completion.

This is helpful in case the `watch` feature is enabled and one of the
following commands `watch | serve --open` is used. If this command would
open the browser, listening for changes would be blocked by the browser.
This commit is contained in:
Johannes Stoelp 2021-09-26 19:55:41 +02:00 committed by Eric Huss
parent a306da3ad7
commit ff4b8e7a8d
3 changed files with 9 additions and 15 deletions

20
Cargo.lock generated
View File

@ -131,9 +131,9 @@ dependencies = [
[[package]]
name = "bstr"
version = "0.2.16"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279"
checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
dependencies = [
"lazy_static",
"memchr",
@ -855,7 +855,7 @@ dependencies = [
"log",
"memchr",
"notify",
"open",
"opener",
"predicates",
"pretty_assertions",
"pulldown-cmark",
@ -1052,12 +1052,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "open"
version = "2.0.1"
name = "opener"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b46b233de7d83bc167fe43ae2dda3b5b84e80e09cceba581e4decb958a4896bf"
checksum = "4ea3ebcd72a54701f56345f16785a6d3ac2df7e986d273eb4395c0b01db17952"
dependencies = [
"pathdiff",
"bstr",
"winapi 0.3.9",
]
@ -1070,12 +1070,6 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "pathdiff"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877630b3de15c0b64cc52f659345724fbf6bdad9bd9566699fc53688f3c34a34"
[[package]]
name = "percent-encoding"
version = "2.1.0"

View File

@ -24,7 +24,7 @@ handlebars = "4.0"
lazy_static = "1.0"
log = "0.4"
memchr = "2.0"
open = "2.0"
opener = "0.5"
pulldown-cmark = "0.7.0"
regex = "1.0.0"
serde = "1.0"

View File

@ -133,7 +133,7 @@ fn get_book_dir(args: &ArgMatches) -> PathBuf {
fn open<P: AsRef<OsStr>>(path: P) {
info!("Opening web browser");
if let Err(e) = open::that(path) {
if let Err(e) = opener::open(path) {
error!("Error opening web browser: {}", e);
}
}