Skip to content

Commit

Permalink
switch from open to opener
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
johannst authored and ehuss committed Sep 26, 2021
1 parent a306da3 commit ff4b8e7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
20 changes: 7 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit ff4b8e7

Please sign in to comment.