mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
feat: add signal handling for graceful shutdown on Windows and Unix (#5023)
* feat: add signal handling for graceful shutdown on Windows and Unix Co-authored-by: oomeow <oomeow@outlook.com> * chore: update Cargo.lock * fix(windows): restore shutdown hook build by enabling missing Win32 APIs and removing stray tracing call Includes the required windows-sys feature expansions and replaces a leftover tracing reference so the Windows shutdown hook builds successfully. * fix: add deprecation warnings for encrypt_data and decrypt_data functions --------- Co-authored-by: oomeow <oomeow@outlook.com> Co-authored-by: Slinetrac <realakayuki@gmail.com>
This commit is contained in:
@@ -11,7 +11,10 @@ use crate::{
|
||||
tray::Tray,
|
||||
},
|
||||
logging, logging_error,
|
||||
module::lightweight::{auto_lightweight_mode_init, run_once_auto_lightweight},
|
||||
module::{
|
||||
lightweight::{auto_lightweight_mode_init, run_once_auto_lightweight},
|
||||
signal,
|
||||
},
|
||||
process::AsyncHandler,
|
||||
utils::{init, logging::Type, server, window_manager::WindowManager},
|
||||
};
|
||||
@@ -30,6 +33,7 @@ pub fn resolve_setup_sync() {
|
||||
AsyncHandler::spawn(|| async {
|
||||
AsyncHandler::spawn_blocking(init_scheme);
|
||||
AsyncHandler::spawn_blocking(init_embed_server);
|
||||
AsyncHandler::spawn_blocking(init_signal);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -132,6 +136,11 @@ pub(super) async fn init_auto_lightweight_mode() {
|
||||
logging_error!(Type::Setup, auto_lightweight_mode_init().await);
|
||||
}
|
||||
|
||||
pub(super) fn init_signal() {
|
||||
logging!(info, Type::Setup, "Initializing signal handlers...");
|
||||
signal::register();
|
||||
}
|
||||
|
||||
pub async fn init_work_config() {
|
||||
logging_error!(Type::Setup, init::init_config().await);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user