Executes a program in place of the current program.
fn exec<P>(path: P, argv: &[*const i8]) -> Result<(), Errno>
where P: ToCString,| Name | Description |
|---|---|
| path | The path of the file that is going to be executed. |
| argv | The arguments that will be passed to the new program in form of |
On success, this function does not return.
The user must have permission to execute the program at path. The environment passed to the program will be the same as the environment passed to this program.
The last element of the argv slice must be a null pointer. The other elements must be pointers to null-terminated strings. The CPtrPtr structure can be used to build argv.
If path is an absolute path or starts with ./ or ../, it is passed directly to execve(2). Otherwise exec iteratively appends path to every element in the PATH environment variable and executes execve(2) on the first existing file. If no such file can be found, an error is returned.