refactor: 优化侧边栏进程清理时机与错误提示

- 仅在应用退出事件时清理 Sidecar 进程,避免重复执行。
- 在开发模式下优化窗口创建错误提示并增强可读性,同时在生产模式下才执行 Sidecar 进程清理逻辑。
This commit is contained in:
2026-01-18 16:47:51 +08:00
parent e703ef669a
commit 92da223d1e
2 changed files with 19 additions and 13 deletions

View File

@@ -25,11 +25,9 @@ pub fn run() {
.expect("error while building tauri application")
.run(|app_handle, event| {
// 监听应用退出事件,清理 Sidecar 进程
match event {
tauri::RunEvent::ExitRequested { .. } | tauri::RunEvent::Exit => {
sidecar::cleanup_sidecar_process(app_handle);
}
_ => {}
if let tauri::RunEvent::Exit = event {
// 只在 Exit 事件时清理,避免重复执行
sidecar::cleanup_sidecar_process(app_handle);
}
});
}