process.execve(file[, args[, env]])
¥Stability: 1 - Experimental
-
file
<string> 要运行的可执行文件的名称或路径。¥
file
<string> The name or path of the executable file to run. -
args
<string[]> 字符串参数列表。任何参数都不能包含空字节(\u0000
)。¥
args
<string[]> List of string arguments. No argument can contain a null-byte (\u0000
). -
env
<Object> 环境变量键值对。任何键或值都不能包含空字节(\u0000
)。默认值:process.env
。¥
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.
这是通过使用 execve
POSIX 函数实现的,因此不会保留当前进程的任何内存或其他资源,标准输入、标准输出和标准错误文件描述符除外。
¥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.
当进程交换时,系统将丢弃所有其他资源,而不会触发任何退出或关闭事件,也不会运行任何清理处理程序。
¥All other resources are discarded by the system when the processes are swapped, without triggering any exit or close events and without running any cleanup handler.
除非发生错误,否则此函数永远不会返回。
¥This function will never return, unless an error occurred.
此功能仅适用于 POSIX 平台(即不适用于 Windows 或安卓)。
¥This function is only available on POSIX platforms (i.e. not Windows or Android).