Skip to content

Commit 50493b4

Browse files
dawedawectron
authored andcommitted
fix: don't open browser if build wasn't successful
1 parent 8ec159c commit 50493b4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/serve/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl ServeSystem {
8888
#[tracing::instrument(level = "trace", skip(self))]
8989
pub async fn run(mut self) -> Result<()> {
9090
// Spawn the watcher & the server.
91-
let _build_res = self.watch.build().await; // TODO: only open after a successful build.
91+
let build_res = self.watch.build().await;
9292
let watch_handle = tokio::spawn(self.watch.run());
9393
let server_handle = Self::spawn_server(
9494
self.cfg.clone(),
@@ -98,7 +98,7 @@ impl ServeSystem {
9898
.await?;
9999

100100
// Open the browser.
101-
if self.cfg.open {
101+
if self.cfg.open && build_res.is_ok() {
102102
if let Err(err) = open::that(self.open_http_addr) {
103103
tracing::error!(error = ?err, "error opening browser");
104104
}

0 commit comments

Comments
 (0)