Skip to content

Commit

Permalink
fix(core/api): cleanup before exit (#5765)
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Dec 7, 2022
1 parent c7bffb0 commit 0f26960
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/core-exit-endpoint-cleanup.md
@@ -0,0 +1,5 @@
---
"tauri": "patch"
---

Cleanup sidecar and tray icons when calling `app.exit()` from JS.
5 changes: 3 additions & 2 deletions core/tauri/src/endpoints/process.rs
Expand Up @@ -37,11 +37,12 @@ impl Cmd {
}

#[module_command_handler(process_exit)]
fn exit<R: Runtime>(_context: InvokeContext<R>, exit_code: i32) -> super::Result<()> {
fn exit<R: Runtime>(context: InvokeContext<R>, exit_code: i32) -> super::Result<()> {
// would be great if we can have a handler inside tauri
// who close all window and emit an event that user can catch
// if they want to process something before closing the app
std::process::exit(exit_code);
context.window.app_handle.exit(exit_code);
Ok(())
}
}

Expand Down

0 comments on commit 0f26960

Please sign in to comment.