Skip to content

feat: expose app exit via JS process API#14767

Open
seekskyworld wants to merge 2 commits into
tauri-apps:devfrom
seekskyworld:feat/14714-app-exit
Open

feat: expose app exit via JS process API#14767
seekskyworld wants to merge 2 commits into
tauri-apps:devfrom
seekskyworld:feat/14714-app-exit

Conversation

@seekskyworld
Copy link
Copy Markdown

@seekskyworld seekskyworld commented Jan 13, 2026

Issue: #14714

Summary:

  • add core app exit command and expose it as JS process.exit
  • remove the leftover Android AppPlugin exit command
  • document app exit permissions and add a change note

Motivation:

  • make the existing exit capability available through the supported API surface

Validation:

  • cargo check -p tauri
  • pnpm -C packages/api ts:check

@seekskyworld seekskyworld requested a review from a team as a code owner January 13, 2026 14:54
@FabianLars
Copy link
Copy Markdown
Member

FabianLars commented Jan 13, 2026

i feel like you kinda ignored my comments in the linked issue? edit: or maybe not, and perhaps you just missed the last link.

anyway, i'm not opposed to an exit js command but it should be part of the app plugin/module or really anything other than "process" because we already have a process plugin.

@FabianLars
Copy link
Copy Markdown
Member

cc @whoever-in-the-working-group-cares anyone against having app.exit in js? Then the process plugin can be just for "other" processes than the current one (or both i guess)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 13, 2026

Package Changes Through c514b55

There are 8 changes which include tauri-utils with patch, tauri-build with patch, tauri-cli with patch, @tauri-apps/cli with patch, tauri-runtime-wry with patch, tauri with minor, @tauri-apps/api with minor, tauri-runtime with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@tauri-apps/api 2.9.1 2.10.0
tauri-utils 2.8.1 2.8.2
tauri-bundler 2.7.5 2.7.6
tauri-runtime 2.9.2 2.9.3
tauri-runtime-wry 2.9.3 2.9.4
tauri-codegen 2.5.2 2.5.3
tauri-macros 2.5.2 2.5.3
tauri-plugin 2.5.2 2.5.3
tauri-build 2.5.3 2.5.4
tauri 2.9.5 2.10.0
@tauri-apps/cli 2.9.6 2.9.7
tauri-cli 2.9.6 2.9.7

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

Copy link
Copy Markdown
Contributor

@Legend-Master Legend-Master left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @whoever-in-the-working-group-cares anyone against having app.exit in js? Then the process plugin can be just for "other" processes than the current one (or both i guess)

Moving exit to core (app) makes a lot of sense to me at least

* @since 2.10.0
*/
async function exit(exitCode?: number): Promise<void> {
const payload = exitCode === undefined ? {} : { exitCode }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could put the default value in the js side? (e.g. { exitCode: exitCode ?? 0 })

*
* @since 2.10.0
*/
async function exit(exitCode?: number): Promise<void> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this to app (packages/api/src/app.ts)

@NyaomiDEV
Copy link
Copy Markdown

Moving exit to core (app) makes a lot of sense to me at least

It makes total sense, and actually it's unclear why the process plugin exists at all, as it only exposes exiting and restarting, something that the app should be able to do by itself.

@FabianLars
Copy link
Copy Markdown
Member

the process plugin was supposed to become more than that, more similar to nodejs' process module

@FabianLars FabianLars added the status: waiting Waiting on author label Feb 9, 2026
@Legend-Master Legend-Master added this to the 2.12 milestone Apr 29, 2026

#[command(root = "crate")]
pub fn exit<R: Runtime>(app: AppHandle<R>, exit_code: Option<i32>) {
app.exit(exit_code.unwrap_or(0));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on Android this should route to the AppPlugin for graceful shutdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting Waiting on author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants