Skip to main content

apply_output_format

Function apply_output_format 

Source
pub fn apply_output_format(
    result: ExecResult,
    format: OutputFormat,
) -> ExecResult
Expand description

Transform an ExecResult into the requested output format.

Serializes regardless of exit code — commands like diff (exit 1 = files differ) and grep (exit 1 = no matches) use non-zero exits for semantic meaning, not errors. The --json contract must hold for all exit codes.