Skip to content

Commit cef0b4d

Browse files
authored
Merge pull request #13 from 0xtbug/dev
Merge from dev
2 parents ac8364c + 50fede5 commit cef0b4d

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

src-tauri/src/commands/cli_proxy.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,10 @@ pub async fn stop_cli_proxy() -> CommandResult<()> {
6666
.map_err(|e| CommandError::General(e.to_string()))?;
6767

6868
if let Some(ref mut child) = *guard {
69-
let pid = child.id();
70-
7169
// On Windows, use taskkill for reliable termination
7270
#[cfg(windows)]
7371
{
72+
let pid = child.id();
7473
let _ = Command::new("taskkill")
7574
.args(["/F", "/T", "/PID", &pid.to_string()])
7675
.creation_flags(CREATE_NO_WINDOW)
@@ -102,6 +101,14 @@ pub async fn stop_cli_proxy() -> CommandResult<()> {
102101
.creation_flags(CREATE_NO_WINDOW)
103102
.output();
104103
}
104+
105+
#[cfg(not(windows))]
106+
{
107+
use std::process::Command;
108+
let _ = Command::new("pkill")
109+
.args(["-f", name])
110+
.output();
111+
}
105112
}
106113
}
107114
*name_guard = None;

src-tauri/src/lib.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ fn cleanup_on_exit() {
1414
// Kill any running CLI proxy process
1515
if let Ok(mut guard) = state::CLI_PROXY_PROCESS.lock() {
1616
if let Some(ref mut child) = *guard {
17-
let pid = child.id();
18-
1917
#[cfg(windows)]
2018
{
2119
use std::process::Command;
2220
use std::os::windows::process::CommandExt;
2321
const CREATE_NO_WINDOW: u32 = 0x08000000;
2422

23+
let pid = child.id();
2524
let _ = Command::new("taskkill")
2625
.args(["/F", "/T", "/PID", &pid.to_string()])
2726
.creation_flags(CREATE_NO_WINDOW)
@@ -54,6 +53,14 @@ fn cleanup_on_exit() {
5453
.creation_flags(CREATE_NO_WINDOW)
5554
.output();
5655
}
56+
57+
#[cfg(not(windows))]
58+
{
59+
use std::process::Command;
60+
let _ = Command::new("pkill")
61+
.args(["-f", name])
62+
.output();
63+
}
5764
}
5865
}
5966
*name_guard = None;

0 commit comments

Comments
 (0)