// 进程退出码。
// CI 门禁依赖退出码:0 无阻断、1 达到阈值、2 用法或读取失败。
// MoonBit 没有内建的非零退出机制;native/llvm 目标通过 C `exit()` 实现,
// 其他目标降级为 abort。
///|
#cfg(any(target="native", target="llvm"))
extern "c" fn exit_with(code : Int32) = "exit"
///|
#cfg(not(any(target="native", target="llvm")))
fn exit_with(code : Int32) -> Unit {
let _ = code
abort("agentsurface: cannot set a specific exit code on this target")
}
///|
pub fn exit_ok() -> Unit {
exit_with(0)
}
///|
pub fn exit_blocked() -> Unit {
exit_with(1)
}
///|
pub fn exit_error() -> Unit {
exit_with(2)
}