From 2edf6b190048d31f58a8ff577ff24338a54d4a0f Mon Sep 17 00:00:00 2001 From: muwoo <2424880409@qq.com> Date: Thu, 14 Nov 2024 12:24:40 +0800 Subject: [PATCH] fix: #1692 single instance mode should not cause restarted applications to exit --- plugins/single-instance/src/platform_impl/windows.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/single-instance/src/platform_impl/windows.rs b/plugins/single-instance/src/platform_impl/windows.rs index 9ec50edbe..ae894b41d 100644 --- a/plugins/single-instance/src/platform_impl/windows.rs +++ b/plugins/single-instance/src/platform_impl/windows.rs @@ -64,8 +64,12 @@ pub fn init(f: Box>) -> TauriPlugin { cbData: bytes.len() as _, lpData: bytes.as_ptr() as _, }; - SendMessageW(hwnd, WM_COPYDATA, 0, &cds as *const _ as _); - app.exit(0); + let contains_restart = data.split('|').any(|part| part.trim() == "restart_from_tauri_api\0"); + // Single instance mode should not cause restarted applications to exit + if !contains_restart { + SendMessageW(hwnd, WM_COPYDATA, 0, &cds as *const _ as _); + app.exit(0); + } } } } else {