mirror of
https://github.com/EasyTier/EasyTier.git
synced 2024-11-16 11:42:27 +08:00
Optimize startup logic contro
This commit is contained in:
parent
f1f3134058
commit
d31c19b126
|
@ -756,13 +756,21 @@ async fn main() {
|
||||||
let locale = sys_locale::get_locale().unwrap_or_else(|| String::from("en-US"));
|
let locale = sys_locale::get_locale().unwrap_or_else(|| String::from("en-US"));
|
||||||
rust_i18n::set_locale(&locale);
|
rust_i18n::set_locale(&locale);
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
{
|
match windows_service::service_dispatcher::start(String::new(), ffi_service_main) {
|
||||||
use windows_service::service_dispatcher;
|
Ok(_) => return,
|
||||||
if let Ok(()) = service_dispatcher::start(String::new(), ffi_service_main) {
|
Err(e) =>
|
||||||
return;
|
{
|
||||||
}
|
let should_panic = if let windows_service::Error::Winapi(ref io_error) = e {
|
||||||
}
|
io_error.raw_os_error() != Some(0x427) // ERROR_FAILED_SERVICE_CONTROLLER_CONNECT
|
||||||
|
} else { true };
|
||||||
|
|
||||||
|
if should_panic {
|
||||||
|
panic!("SCM start an error: {}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
let cfg = TomlConfigLoader::from(cli);
|
let cfg = TomlConfigLoader::from(cli);
|
||||||
init_logger(&cfg, false).unwrap();
|
init_logger(&cfg, false).unwrap();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user