Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

fix(process): don't spawn taskkill when the child started nothing (#2056)

WangTongchaof70eb13f7534
diff --git a/crates/ide-core/src/process.rs b/crates/ide-core/src/process.rs
index 0eb1bae87..e40a9d069 100644
--- a/crates/ide-core/src/process.rs
+++ b/crates/ide-core/src/process.rs
@@ -110,6 +110,12 @@ const TREE_EXIT_WAIT: Duration = Duration::from_secs(5);
#[cfg(windows)]
fn taskkill_tree_of(pid: u32) {
let started = windows_tree::descendants(pid);
+ // When the child started nothing, killing it alone is the whole job:
+ // `taskkill` would be a process spawn (measured at ~0.7 s here) for the
+ // same outcome, and the callers kill the child themselves.
+ if started.is_empty() {
+ return;
+ }
let mut taskkill = Command::new("taskkill");
prepare(&mut taskkill)
.args(["/T", "/F", "/PID", &pid.to_string()])