is_ipc_file_exist quote Config::ipc_path (#8295)

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2024-06-08 21:56:47 +08:00 committed by GitHub
parent ffac670f95
commit 57570c3ba6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -972,9 +972,11 @@ pub async fn test_rendezvous_server() -> ResultType<()> {
#[cfg(windows)]
pub fn is_ipc_file_exist(suffix: &str) -> ResultType<bool> {
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 {