Skip to main content

run_git_with_timeout

Function run_git_with_timeout 

Source
pub fn run_git_with_timeout(
    cmd: Command,
    timeout: Duration,
) -> Result<Output, GitRunError>
Expand description

Runs cmd to completion, killing it if it exceeds timeout.

Command::output() blocks forever on a remote that accepts the connection but never replies, which is exactly what a firewalled or blackholed host does. This drains stdout and stderr on dedicated threads (a bare try_wait poll loop deadlocks once a pipe buffer fills) while a timer supervises the child.

A zero timeout means “no limit” and simply defers to output().