From a2979f804998ecb0224d998b63aaa54240d7a6e3 Mon Sep 17 00:00:00 2001 From: muwoo <2424880409@qq.com> Date: Thu, 14 Nov 2024 12:34:38 +0800 Subject: [PATCH 1/4] fix(windows): #1692 The restart api does not work in single-instance mode --- core/tauri/src/api/process.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/tauri/src/api/process.rs b/core/tauri/src/api/process.rs index 865a826d9a6c..62f3127eaba4 100644 --- a/core/tauri/src/api/process.rs +++ b/core/tauri/src/api/process.rs @@ -87,7 +87,11 @@ pub fn restart(env: &Env) { #[cfg(target_os = "macos")] restart_macos_app(&path, env); - if let Err(e) = Command::new(path).args(&env.args).spawn() { + // Copy the existing command line arguments and add the "restart" argument to the beginning + let mut args = vec!["restart_from_tauri_api".to_string()]; + args.extend(env.args.iter().cloned()); + + if let Err(e) = Command::new(path).args(&args).spawn() { log::error!("failed to restart app: {e}"); } } From 2564620d3a4a340239f23648c83e90d0d211aa8d Mon Sep 17 00:00:00 2001 From: muwoo <2424880409@qq.com> Date: Thu, 14 Nov 2024 12:38:50 +0800 Subject: [PATCH 2/4] fix(windows): #1692 The restart api does not work in single-instance mode --- .changes/fix-single-instance-restart | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/fix-single-instance-restart diff --git a/.changes/fix-single-instance-restart b/.changes/fix-single-instance-restart new file mode 100644 index 000000000000..49a9f2cf8197 --- /dev/null +++ b/.changes/fix-single-instance-restart @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +fix(windows): #1692 The restart api does not work in single-instance mode From b0c6a86eebc7696d42298741e5041aee0e759f4c Mon Sep 17 00:00:00 2001 From: muwoo <2424880409@qq.com> Date: Thu, 14 Nov 2024 12:39:34 +0800 Subject: [PATCH 3/4] Rename fix-single-instance-restart to fix-single-instance-restart.md --- ...fix-single-instance-restart => fix-single-instance-restart.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .changes/{fix-single-instance-restart => fix-single-instance-restart.md} (100%) diff --git a/.changes/fix-single-instance-restart b/.changes/fix-single-instance-restart.md similarity index 100% rename from .changes/fix-single-instance-restart rename to .changes/fix-single-instance-restart.md From 3f805369f5239720cf147f3ee0f3db7a56808440 Mon Sep 17 00:00:00 2001 From: muwoo <2424880409@qq.com> Date: Thu, 14 Nov 2024 12:46:15 +0800 Subject: [PATCH 4/4] fix(windows): The restart api does not work in single-instance mode --- .changes/fix-single-instance-restart.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changes/fix-single-instance-restart.md b/.changes/fix-single-instance-restart.md index 49a9f2cf8197..4a92606b1a5f 100644 --- a/.changes/fix-single-instance-restart.md +++ b/.changes/fix-single-instance-restart.md @@ -2,4 +2,4 @@ "tauri": patch --- -fix(windows): #1692 The restart api does not work in single-instance mode +fix(windows): The restart api does not work in single-instance mode