Skip to content

Commit 0f26960

Browse files
authored
fix(core/api): cleanup before exit (#5765)
1 parent c7bffb0 commit 0f26960

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": "patch"
3+
---
4+
5+
Cleanup sidecar and tray icons when calling `app.exit()` from JS.

core/tauri/src/endpoints/process.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ impl Cmd {
3737
}
3838

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

0 commit comments

Comments
 (0)