aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-28 22:40:33 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-28 22:40:33 +0800
commit18acfba07497ff5554f2790a170d003ed6a7dbfb (patch)
treeaf16e82153cea2930dd7fffd9cb780c31f81917a
parent6c8ffbadb82bd4e0596fa23f26d5a48a82268eb2 (diff)
feat(renderer): add exit_process method to RenderResultHEADmain
-rw-r--r--mingling_core/src/renderer/render_result.rs20
1 files changed, 19 insertions, 1 deletions
diff --git a/mingling_core/src/renderer/render_result.rs b/mingling_core/src/renderer/render_result.rs
index d5b91ef..fc3f2b1 100644
--- a/mingling_core/src/renderer/render_result.rs
+++ b/mingling_core/src/renderer/render_result.rs
@@ -1,7 +1,7 @@
use std::{
fmt::{Display, Formatter},
io::Write,
- process::ExitCode,
+ process::{ExitCode, exit},
};
use crate::RenderResultMode::{Stderr, Stdout};
@@ -496,6 +496,24 @@ impl RenderResult {
exit_code: self.exit_code,
}
}
+
+ /// Exits the process with the exit code stored in this `RenderResult`.
+ ///
+ /// This method calls `std::process::exit()` with the `exit_code` value,
+ /// terminating the current process immediately.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// use mingling_core::RenderResult;
+ ///
+ /// let mut result = RenderResult::new();
+ /// result.exit_code = 42;
+ /// // result.exit_process(); // would exit with code 42
+ /// ```
+ pub fn exit_process(&self) {
+ exit(self.exit_code)
+ }
}
#[inline(always)]