mirror of
https://github.com/EasyTier/EasyTier.git
synced 2024-11-16 03:32:43 +08:00
When running in a Windows service environment, delegate the termination of the program to the win_service_event_loop function.
This commit is contained in:
parent
68b8800900
commit
a6f215dcdf
|
@ -678,6 +678,7 @@ fn win_service_event_loop(
|
|||
exit_code: ServiceExitCode::Win32(0),
|
||||
process_id: None
|
||||
}).unwrap();
|
||||
std::process::exit(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -738,7 +739,7 @@ async fn main() {
|
|||
|
||||
#[cfg(target_os = "windows")]
|
||||
match windows_service::service_dispatcher::start(String::new(), ffi_service_main) {
|
||||
Ok(_) => return,
|
||||
Ok(_) => std::thread::park(),
|
||||
Err(e) =>
|
||||
{
|
||||
let should_panic = if let windows_service::Error::Winapi(ref io_error) = e {
|
||||
|
|
Loading…
Reference in New Issue
Block a user