mirror of https://github.com/tauri-apps/tauri
parent
2b4e2b7560
commit
ac2cbcb131
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"cli.rs": patch
|
||||
---
|
||||
|
||||
Properly kill `beforeDevCommand` process.
|
|
@ -29,7 +29,18 @@ static BEFORE_DEV: OnceCell<Mutex<Child>> = OnceCell::new();
|
|||
|
||||
fn kill_before_dev_process() {
|
||||
if let Some(child) = BEFORE_DEV.get() {
|
||||
let _ = child.lock().unwrap().kill();
|
||||
let mut child = child.lock().unwrap();
|
||||
#[cfg(windows)]
|
||||
let _ = Command::new("powershell")
|
||||
.arg("-Command")
|
||||
.arg(format!("function Kill-Tree {{ Param([int]$ppid); Get-CimInstance Win32_Process | Where-Object {{ $_.ParentProcessId -eq $ppid }} | ForEach-Object {{ Kill-Tree $_.ProcessId }}; Stop-Process -Id $ppid }}; Kill-Tree {}", child.id()))
|
||||
.status();
|
||||
#[cfg(not(windows))]
|
||||
let _ = Command::new("pkill")
|
||||
.args(&["-TERM", "-P"])
|
||||
.arg(child.id().to_string())
|
||||
.status();
|
||||
let _ = child.kill();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue