fix(proxy): wait for server shutdown before exiting app

The previous cleanup logic only sent a shutdown signal but didn't wait
for the proxy server to actually stop. This caused a race condition
where the app would exit before cleanup completed, leaving Live configs
in an inconsistent state.

Changes:
- Add `server_handle` field to ProxyServer to track the spawned task
- Modify `stop()` to wait for server task completion (5s timeout)
- Add 100ms delay before process exit to ensure I/O flush
- Export ProxyService and fix test files that were missing proxy_service field
This commit is contained in:
Jason
2025-12-11 20:10:21 +08:00
parent 395783e22a
commit 1e3a978ecb
5 changed files with 40 additions and 16 deletions
+1 -1
View File
@@ -232,7 +232,7 @@ fn scan_cli_version(tool: &str) -> (Option<String>, Option<String>) {
// 构建 PATH 环境变量,确保 node 可被找到
let current_path = std::env::var("PATH").unwrap_or_default();
let new_path = format!("{}:{}", path.display(), current_path);
let output = Command::new(&tool_path)
.arg("--version")
.env("PATH", &new_path)