Skip to main content

run_with_program

Function run_with_program 

Source
pub fn run_with_program(
    program: &OsStr,
    arguments: &[OsString],
    diagnostics: &mut dyn Write,
) -> i32
Expand description

What: Run program pre-push <arguments> with this process’s standard streams and report Git’s verdict for the hook. Why: Standard input carries the ref-update lines Git computed, so the child inherits it untouched; only a failure to start or a non-zero status adds this wrapper’s explanation, and the child’s status is the hook’s status.

In TS you’d write (pseudocode):

const { status } = spawnSync(program, ['pre-push', ...args], { stdio: 'inherit' });