quit cm process if ipc connection to ipc server closed (#9292)

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages
2024-09-08 12:37:41 +08:00
committed by GitHub
parent c8cd564e69
commit 993862c103
4 changed files with 23 additions and 3 deletions

View File

@@ -84,6 +84,7 @@ lazy_static::lazy_static! {
// Is server logic running. The server code can invoked to run by the main process if --server is not running.
static ref SERVER_RUNNING: Arc<RwLock<bool>> = Default::default();
static ref IS_MAIN: bool = std::env::args().nth(1).map_or(true, |arg| !arg.starts_with("--"));
static ref IS_CM: bool = std::env::args().nth(1) == Some("--cm".to_owned()) || std::env::args().nth(1) == Some("--cm-no-ui".to_owned());
}
pub struct SimpleCallOnReturn {
@@ -137,6 +138,11 @@ pub fn is_main() -> bool {
*IS_MAIN
}
#[inline]
pub fn is_cm() -> bool {
*IS_CM
}
// Is server logic running.
#[inline]
pub fn is_server_running() -> bool {