fix, windows try kill flutter main window process only when --server's ipc is (#8086)

occupied

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2024-05-18 23:14:42 +08:00
committed by GitHub
parent 96f41fcc02
commit d3eaa6600d
3 changed files with 23 additions and 10 deletions

View File

@@ -470,6 +470,11 @@ pub async fn start_server(is_server: bool) {
std::thread::spawn(move || {
if let Err(err) = crate::ipc::start("") {
log::error!("Failed to start ipc: {}", err);
#[cfg(all(windows, feature = "flutter"))]
if crate::is_server() && crate::ipc::test_ipc_connection().is_ok() {
log::error!("ipc is occupied by another process, try kill it");
crate::platform::try_kill_flutter_main_window_process();
}
std::process::exit(-1);
}
});