nix::unistd

Function execve

source
pub fn execve<SA: AsRef<CStr>, SE: AsRef<CStr>>(
    path: &CStr,
    args: &[SA],
    env: &[SE],
) -> Result<Infallible>
Expand description

Replace the current process image with a new one (see execve(2)).

The execve system call allows for another process to be “called” which will replace the current process image. That is, this process becomes the new command that is run. On success, this function will not return. Instead, the new program will run until it exits.

::nix::unistd::execv and ::nix::unistd::execve take as arguments a slice of ::std::ffi::CStrings for args and env (for execve). Each element in the args list is an argument to the new process. Each element in the env list should be a string in the form “key=value”.