Skip to content

Commit 759d1af

Browse files
authored
feat(cli): improve error message when dev runner command fails (#3447)
1 parent 8d0d4f2 commit 759d1af

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"cli.rs": patch
3+
"cli.js": patch
4+
---
5+
6+
Improve error message when the dev runner command fails.

tooling/cli/src/dev.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ pub fn command(options: Options) -> Result<()> {
225225
}
226226
}
227227

228-
let mut process = start_app(&options, &runner, &cargo_features, child_wait_rx.clone());
228+
let mut process = start_app(&options, &runner, &cargo_features, child_wait_rx.clone())?;
229229

230230
let (tx, rx) = channel();
231231

@@ -268,7 +268,7 @@ pub fn command(options: Options) -> Result<()> {
268268
break;
269269
}
270270
}
271-
process = start_app(&options, &runner, &cargo_features, child_wait_rx.clone());
271+
process = start_app(&options, &runner, &cargo_features, child_wait_rx.clone())?;
272272
}
273273
}
274274
}
@@ -298,7 +298,7 @@ fn start_app(
298298
runner: &str,
299299
features: &[String],
300300
child_wait_rx: Arc<Mutex<Receiver<()>>>,
301-
) -> Arc<SharedChild> {
301+
) -> Result<Arc<SharedChild>> {
302302
let mut command = Command::new(runner);
303303
command.args(&["run", "--no-default-features"]);
304304

@@ -321,7 +321,7 @@ fn start_app(
321321
command.pipe().unwrap();
322322

323323
let child =
324-
SharedChild::spawn(&mut command).unwrap_or_else(|_| panic!("failed to run {}", runner));
324+
SharedChild::spawn(&mut command).with_context(|| format!("failed to run {}", runner))?;
325325
let child_arc = Arc::new(child);
326326

327327
let child_clone = child_arc.clone();
@@ -349,5 +349,5 @@ fn start_app(
349349
}
350350
});
351351

352-
child_arc
352+
Ok(child_arc)
353353
}

0 commit comments

Comments
 (0)