From ff4b8e7a8d1e49ecdda97fc974bc0532c92a68b2 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Sun, 26 Sep 2021 19:55:41 +0200 Subject: [PATCH] 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. --- Cargo.lock | 20 +++++++------------- Cargo.toml | 2 +- src/main.rs | 2 +- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f1992bc9..c244e651 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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" diff --git a/Cargo.toml b/Cargo.toml index 79ae2878..045c66b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/main.rs b/src/main.rs index 4843c95d..1f286d2d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -133,7 +133,7 @@ fn get_book_dir(args: &ArgMatches) -> PathBuf { fn open>(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); } }