From 95c6b979ca399671eed8bf9c72f53cfe5d46f431 Mon Sep 17 00:00:00 2001 From: Weicao-CatilGrass <1992414357@qq.com> Date: Wed, 13 May 2026 07:28:02 +0800 Subject: Migrate exit code control to resource-based system --- CHANGELOG.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'CHANGELOG.md') diff --git a/CHANGELOG.md b/CHANGELOG.md index 499161e..96db9ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,13 +46,22 @@ if mingling::feature::MINGLING_ASYNC { } ``` -5. **\[core\]** Added `with_hook` and `with_hook_anonymous` functions to embed callback events into the program lifecycle +5. **\[core\]** Added `with_hook` functions to embed callback events into the program lifecycle 6. **\[core\]** Added `user_context.run_hook` configuration item to control whether the program runs hooks 7. **\[core\]** Added `exec_and_exit`, which will return an `i32` exit code after the program ends -8. **\[core\]** Added `ExitCodeSetup`, now you can use `mingling::update_exit_code(i32)` to control the exit code +8. **\[core\]** Added `ExitCodeSetup`, you can control the program's exit code by modifying the `mingling::res::ExitCode` resource + +```rust +#[chain] +fn your_chain(_prev: Prev) -> NextProcess { + // Use `modify_res` to modify the value of `ExitCode` + this::().modify_res(|r: &mut ExitCode| r.exit_code = 1); + // ... +} +``` 9. **\[core\]** `RenderResult` now carries new data `exit_code` -- cgit