Function replace_current_process

Source
pub async fn replace_current_process(
    env: &mut Env,
    path: CString,
    args: Vec<CString>,
    location: Location,
)
Expand description

Substitutes the currently executing shell process with the external utility.

This function performs the very last step of the simple command execution. It disables the internal signal dispositions and calls the execve system call. If the call fails, it prints an error message to the standard error and updates env.exit_status, in which case the caller should immediately exit the current process with the exit status.

If the execve call fails with ENOEXEC, this function falls back on invoking the shell with the given arguments, so that the shell can interpret the script. The path to the shell executable is taken from System::shell_path.