diff --git a/src/ipc.rs b/src/ipc.rs index c660fc33f..a10a8f955 100644 --- a/src/ipc.rs +++ b/src/ipc.rs @@ -972,9 +972,11 @@ pub async fn test_rendezvous_server() -> ResultType<()> { #[cfg(windows)] pub fn is_ipc_file_exist(suffix: &str) -> ResultType { - let file_name = format!("{}\\query{}", crate::get_app_name(), suffix); + // Not change this to std::path::Path::exists, unless it can be ensured that it can find the ipc which occupied by a process that taskkill can't kill. + let prefix = "\\\\.\\pipe\\"; + let file_name = Config::ipc_path(suffix).replace(prefix, ""); let mut err = None; - for entry in std::fs::read_dir("\\\\.\\pipe\\")? { + for entry in std::fs::read_dir(prefix)? { match entry { Ok(entry) => { if entry.file_name().into_string().unwrap_or_default() == file_name {