Skip to main content

replace_process_with_real_git

Function replace_process_with_real_git 

Source
pub fn replace_process_with_real_git(
    real_git: &Path,
    arguments: &[OsString],
    overlay: &[(OsString, OsString)],
) -> Error
Expand description

What: Become real Git; returns only when Git could not be started. The returned std::io::Error says why the operating system refused. #[cfg(unix)] and #[cfg(not(unix))] each compile one of the two inner blocks. Why: On Unix this process is replaced by Git, which is exact forwarding: same process ID, same streams, same signals, same exit status, and no wrapper process left between the caller and Git. Windows cannot replace a process image; the nearest faithful behaviour there is to wait for Git and exit with its status.

In TS you’d write (pseudocode):

// Unix has no Node equivalent: process.execve(realGit, args, env) replaces the process image.
// Elsewhere: process.exit(exitCode(await runRealGit(realGit, args, overlay)));