Skip to main content

read_exit_code_from_log

Function read_exit_code_from_log 

Source
pub fn read_exit_code_from_log(log_path: &str) -> Option<i32>
Expand description

Read the terminal exit code from the anchored footer at the end of a log.

The footer start itself writes (see create_log_footer() and shell_log_footer_snippet()) is a three-line block:

==================================================
Finished: 2026-07-30 23:36:20.295
Exit Code: 0

Matching the whole block at line starts means a bare Exit Code: N substring emitted by the wrapped command (inside a JSON payload, a quoted log excerpt, an rg dump, …) can no longer be mistaken for the footer (issue #150). Returns None when the log has no footer yet — never a number parsed out of the command’s own output.