Browse Source

Merge branch 'master' into patch-exec-service

GnoCiYeH 1 year ago
parent
commit
fd499528c2
4 changed files with 8 additions and 9 deletions
  1. 0 2
      src/executor/service_executor/mod.rs
  2. 3 3
      src/main.rs
  3. 4 4
      src/manager/mod.rs
  4. 1 0
      src/unit/service/mod.rs

+ 0 - 2
src/executor/service_executor/mod.rs

@@ -195,8 +195,6 @@ impl ServiceExecutor {
         //TODO: 需要考虑是否需要在此处执行退出后代码,还是只需要显式退出时才执行
         let _ = Self::exec_stop_post(service);
 
-        //
-
         //判断是否需要restart,需要则再次启动服务
         if service.service_part().restart().is_restart(&exit_status) {
             let _ = Self::exec_reload(service);

+ 3 - 3
src/main.rs

@@ -1,5 +1,5 @@
-// #![no_std]
-// #![no_main]
+#![no_std]
+#![no_main]
 #![feature(slice_pattern)]
 
 use cfg_if::cfg_if;
@@ -120,7 +120,7 @@ fn main() {
             }
         }
     }
-
+  
     units_file_name.push("/home/heyicong/DragonReach/parse_test/test.service".to_string());
 
     //启动服务

+ 4 - 4
src/manager/mod.rs

@@ -67,9 +67,9 @@ impl Manager {
         }
 
         // 交付处理子进程退出逻辑
-        // for tmp in exited_unit {
-        //     let unit = UnitManager::get_unit_with_id(&tmp.0).unwrap();
-        //     unit.lock().unwrap().after_exit(tmp.1);
-        // }
+        for tmp in exited_unit {
+            let unit = UnitManager::get_unit_with_id(&tmp.0).unwrap();
+            unit.lock().unwrap().after_exit(tmp.1);
+        }
     }
 }

+ 1 - 0
src/unit/service/mod.rs

@@ -1,6 +1,7 @@
 use super::{BaseUnit, Unit};
 use crate::error::runtime_error::{RuntimeError, RuntimeErrorType};
 use crate::error::{parse_error::ParseError, parse_error::ParseErrorType};
+use crate::executor::ExitStatus;
 use crate::executor::service_executor::ServiceExecutor;
 use crate::executor::ExitStatus;
 use crate::manager::UnitManager;