浏览代码

feat(core): run cleanup code on the relaunch API (#3629)

Lucas Fernandes Nogueira 3 年之前
父节点
当前提交
9c65abce1b
共有 2 个文件被更改,包括 6 次插入1 次删除
  1. 5 0
      .changes/api-relaunch-cleanup.md
  2. 1 1
      core/tauri/src/endpoints/process.rs

+ 5 - 0
.changes/api-relaunch-cleanup.md

@@ -0,0 +1,5 @@
+---
+"tauri": patch
+---
+
+Run `AppHandle` cleanup code before restarting the application on the `process > relaunch` API.

+ 1 - 1
core/tauri/src/endpoints/process.rs

@@ -23,7 +23,7 @@ pub enum Cmd {
 impl Cmd {
 impl Cmd {
   #[module_command_handler(process_relaunch, "process > relaunch")]
   #[module_command_handler(process_relaunch, "process > relaunch")]
   fn relaunch<R: Runtime>(context: InvokeContext<R>) -> super::Result<()> {
   fn relaunch<R: Runtime>(context: InvokeContext<R>) -> super::Result<()> {
-    crate::api::process::restart(&context.window.state());
+    context.window.app_handle().restart();
     Ok(())
     Ok(())
   }
   }