process.execArgv
process.execArgv
属性返回 Node.js 进程启动时传入的一组特定于 Node.js 的命令行选项。
这些选项不会出现在 process.argv
属性返回的数组中,也不包括 Node.js 可执行文件、脚本名称或脚本名称后面的任何选项。
这些选项可用于衍生与父进程具有相同执行环境的子进程。
$ node --harmony script.js --version
process.execArgv
的结果:
['--harmony']
process.argv
的结果:
['/usr/local/bin/node', 'script.js', '--version']
有关具有此属性的工作线程的详细行为,请参阅 Worker
构造函数。
The process.execArgv
property returns the set of Node.js-specific command-line
options passed when the Node.js process was launched. These options do not
appear in the array returned by the process.argv
property, and do not
include the Node.js executable, the name of the script, or any options following
the script name. These options are useful in order to spawn child processes with
the same execution environment as the parent.
$ node --harmony script.js --version
Results in process.execArgv
:
['--harmony']
And process.argv
:
['/usr/local/bin/node', 'script.js', '--version']
Refer to Worker
constructor for the detailed behavior of worker
threads with this property.