Skip to main content

exec

Function exec 

Source
pub fn exec(argv: &[CString], envp: &[CString]) -> Errno
Expand description

Replace the current process image with a new program.

If argv[0] contains a /, uses it as a direct path. Otherwise searches PATH (extracted from envp) for the binary.

Uses execve(2) on all platforms — no reliance on platform-specific variants like execvpe (Linux-only) or execvp (inherits process env instead of using the shell’s envp).

Does not return on success.