mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 04:43:44 +08:00
chore: remove useless exit codes
This commit is contained in:
parent
54296ba84a
commit
d1eeeab7b1
@ -372,7 +372,7 @@ pub fn open_devtools(app_handle: tauri::AppHandle) {
|
|||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn exit_app() {
|
pub fn exit_app() {
|
||||||
feat::quit();
|
feat::quit(Some(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod service {
|
pub mod service {
|
||||||
|
@ -60,7 +60,8 @@ impl Hotkey {
|
|||||||
"clash_mode_direct" => || feat::change_clash_mode("direct".into()),
|
"clash_mode_direct" => || feat::change_clash_mode("direct".into()),
|
||||||
"toggle_system_proxy" => feat::toggle_system_proxy,
|
"toggle_system_proxy" => feat::toggle_system_proxy,
|
||||||
"toggle_tun_mode" => feat::toggle_tun_mode,
|
"toggle_tun_mode" => feat::toggle_tun_mode,
|
||||||
"quit" => feat::quit,
|
"quit" => || feat::quit(Some(0)),
|
||||||
|
|
||||||
_ => bail!("invalid function \"{func}\""),
|
_ => bail!("invalid function \"{func}\""),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -431,7 +431,7 @@ fn on_menu_event(app_handle: &AppHandle, event: MenuEvent) {
|
|||||||
"restart_app" => tauri::process::restart(&app_handle.env()),
|
"restart_app" => tauri::process::restart(&app_handle.env()),
|
||||||
"quit" => {
|
"quit" => {
|
||||||
println!("quit");
|
println!("quit");
|
||||||
feat::quit();
|
feat::quit(Some(0));
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
@ -98,12 +98,12 @@ pub fn toggle_tun_mode() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn quit() {
|
pub fn quit(code: Option<i32>) {
|
||||||
let app_handle = handle::Handle::global().app_handle().unwrap();
|
let app_handle = handle::Handle::global().app_handle().unwrap();
|
||||||
let _ = resolve::save_window_size_position(true);
|
let _ = resolve::save_window_size_position(true);
|
||||||
resolve::resolve_reset();
|
resolve::resolve_reset();
|
||||||
app_handle.exit(0);
|
app_handle.exit(code.unwrap_or(0));
|
||||||
std::process::exit(0);
|
//std::process::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 修改clash的订阅
|
/// 修改clash的订阅
|
||||||
@ -200,7 +200,10 @@ pub async fn patch_verge(patch: IVerge) -> Result<()> {
|
|||||||
if (socks_enabled.is_some()
|
if (socks_enabled.is_some()
|
||||||
|| http_enabled.is_some()
|
|| http_enabled.is_some()
|
||||||
|| socks_port.is_some()
|
|| socks_port.is_some()
|
||||||
|| http_port.is_some() || mixed_port.is_some()) && !generated {
|
|| http_port.is_some()
|
||||||
|
|| mixed_port.is_some())
|
||||||
|
&& !generated
|
||||||
|
{
|
||||||
Config::generate().await?;
|
Config::generate().await?;
|
||||||
CoreManager::global().run_core().await?;
|
CoreManager::global().run_core().await?;
|
||||||
}
|
}
|
||||||
|
@ -134,8 +134,10 @@ pub fn run() {
|
|||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
|
|
||||||
app.run(|_, e| match e {
|
app.run(|_, e| match e {
|
||||||
tauri::RunEvent::ExitRequested { api, .. } => {
|
tauri::RunEvent::ExitRequested { api, code, .. } => {
|
||||||
api.prevent_exit();
|
if code.is_none() {
|
||||||
|
api.prevent_exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tauri::RunEvent::WindowEvent { label, event, .. } => {
|
tauri::RunEvent::WindowEvent { label, event, .. } => {
|
||||||
if label == "main" {
|
if label == "main" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user