mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 00:20:08 +01:00
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>
15 lines
421 B
JavaScript
15 lines
421 B
JavaScript
const assert = require('assert');
|
|
|
|
console.log('process.argv:', JSON.stringify(process.argv));
|
|
console.log('process.execArgv:', JSON.stringify(process.execArgv));
|
|
|
|
// Should only have execArgv from SEA config, no NODE_OPTIONS
|
|
assert.deepStrictEqual(process.execArgv, ['--no-warnings']);
|
|
|
|
assert.deepStrictEqual(process.argv.slice(2), [
|
|
'user-arg1',
|
|
'user-arg2'
|
|
]);
|
|
|
|
console.log('execArgvExtension none test passed');
|