This implements the execArgvExtension configuration field for SEA, which takes one of three string values to specify whether and how execution arguments can be extended for the SEA at run time: * `"none"`: No extension is allowed. Only the arguments specified in `execArgv` will be used, and the `NODE_OPTIONS` environment variable will be ignored. * `"env"`: _(Default)_ The `NODE_OPTIONS` environment variable can extend the execution arguments. This is the default behavior to maintain backward compatibility. * `"cli"`: The executable can be launched with `--node-options="--flag1 --flag2"`, and those flags will be parsed as execution arguments for Node.js instead of being passed to the user script. This allows using arguments that are not supported by the `NODE_OPTIONS` environment variable. PR-URL: https://github.com/nodejs/node/pull/59560 Fixes: https://github.com/nodejs/node/issues/55573 Fixes: https://github.com/nodejs/single-executable/issues/100 Refs: https://github.com/nodejs/node/issues/51688 Reviewed-By: Xuguang Mei <meixuguang@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
14 lines
448 B
JavaScript
14 lines
448 B
JavaScript
const assert = require('assert');
|
|
|
|
console.log('process.argv:', JSON.stringify(process.argv));
|
|
console.log('process.execArgv:', JSON.stringify(process.execArgv));
|
|
|
|
// Should have execArgv from SEA config + CLI --node-options
|
|
assert.deepStrictEqual(process.execArgv, ['--no-warnings', '--max-old-space-size=1024']);
|
|
|
|
assert.deepStrictEqual(process.argv.slice(2), [
|
|
'user-arg1',
|
|
'user-arg2'
|
|
]);
|
|
|
|
console.log('execArgvExtension cli test passed');
|