pub async fn apply_spill_contract(
result: &mut ExecResult,
config: &OutputLimitConfig,
)Expand description
Apply the kernel’s spill/exit-3 contract to a raw ExecResult: run the
output-limit spill check when enabled, then remap the exit code to 3
whenever did_spill ends up set — whether spill_if_needed just set it,
or a lower-level capture-ring overflow already had (kernel.rs’s
try_execute_external, GH #191).
This is the ONE seam every execution surface that produces a raw
ExecResult — the foreground pipeline (Kernel::execute_pipeline), a
background job (Kernel::execute_background), a scatter worker
(run_parallel) — must funnel through before treating that result as
final. Without it, spilled output silently reports its ORIGINAL exit code
instead of the loud 3, and a downstream success/failure decision (a
background job’s JobStatus, gather’s 0-vs-123 aggregation) reads the
wrong thing (GH #212).