Method execve
execve(string, string[], string[])
Executes a specified program, replacing the current process with the new program.
public static extern int execve(string path, string[] argv, string[] envp)
Parameters
pathstringThe path to the executable file to be executed. This cannot be null or empty.
argvstring[]An array of arguments to pass to the program. The first element is typically the program name. This cannot be null.
envpstring[]An array of environment variables to set for the new program. Each element should be in the format "KEY=VALUE". This can be null to inherit the current process's environment.
Returns
- int
Returns 0 on success. On failure, returns -1 and sets the last error, which can be retrieved.
Remarks
This method replaces the current process image with a new process image
specified by path. It does not return on success, as the
current process is replaced.
On failure, the method returns -1.