On this page

    process.execve(file, args?, env?): void
    Stability: 1Experimental
    Attributes
    file:string
    The name or path of the executable file to run.
    args:string[]
    List of string arguments. No argument can contain a null-byte (\u0000).
    env?:Object
    Environment key-value pairs. No key or value can contain a null-byte (\u0000). Default: process.env.

    Replaces the current process with a new process.

    This is achieved by using the execve POSIX function and therefore no memory or other resources from the current process are preserved, except for the standard input, standard output and standard error file descriptor.

    On success, all other resources are discarded by the system when the processes are swapped, without triggering any exit or close events, without running any JavaScript cleanup handler (for example process.on('exit')), and without invoking native AtExit callbacks registered through the embedder API. Callers that need to run cleanup logic should do so before calling process.execve().

    This function does not return on success. If the underlying execve(2) system call fails, an Error is thrown whose code property is set to the corresponding errno string (for example, 'ENOENT' when file does not exist), with syscall set to 'execve' and path set to file. When execve(2) fails the current process continues to run with its state unchanged, so a caller may handle the error and take another action.

    This function is not available on Windows or IBM i.