Mountain/IPC/WindServiceHandlers/NativeHost/Exit.rs
1
2//! `nativeHost:exit` - exit with an explicit code.
3//! VS Code calls this from `NativeHostMainService.exit(code)` when an
4//! extension or the workbench requests a non-zero exit (crash reporter,
5//! restart-on-crash sentinel, etc.).
6
7use serde_json::Value;
8use tauri::AppHandle;
9
10use crate::dev_log;
11
12pub async fn Fn(ApplicationHandle:AppHandle, Arguments:Vec<Value>) -> Result<Value, String> {
13 let Code = Arguments.first().and_then(Value::as_i64).unwrap_or(0) as i32;
14
15 dev_log!("lifecycle", "nativeHost:exit code={}", Code);
16
17 ApplicationHandle.exit(Code);
18
19 Ok(Value::Null)
20}