mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
b32c7229d5
When the worker spawning code copies NODE_OPTIONS from process.env, previously we do a check again on the copied NODE_OPTIONS and throw if it contains per-process settings. This can be problematic if the end user starts the process with a NODE_OPTIONS and the worker is spawned by a third-party that tries to extend process.env with some overrides before passing them into the worker. This patch adds another exception that allows the per-process options in the NODE_OPTIONS passed to a worker if the NODE_OPTIONS is character-by-character equal to the parent NODE_OPTIONS. While some more intelligent filter can be useful too, this works good enough for the inheritance case, when the worker spawning code does not intend to modify NODE_OPTIONS. PR-URL: https://github.com/nodejs/node/pull/53596 Refs: https://github.com/nodejs/node/issues/41103 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Xuguang Mei <meixuguang@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
36 lines
591 B
JavaScript
36 lines
591 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
const {
|
|
spawnSyncAndExitWithoutError,
|
|
spawnSyncAndAssert,
|
|
} = require('../common/child_process');
|
|
const fixtures = require('../common/fixtures');
|
|
spawnSyncAndExitWithoutError(
|
|
process.execPath,
|
|
[
|
|
fixtures.path('spawn-worker-with-copied-env'),
|
|
],
|
|
{
|
|
env: {
|
|
...process.env,
|
|
NODE_OPTIONS: '--title=foo'
|
|
}
|
|
}
|
|
);
|
|
|
|
spawnSyncAndAssert(
|
|
process.execPath,
|
|
[
|
|
fixtures.path('spawn-worker-with-trace-exit'),
|
|
],
|
|
{
|
|
env: {
|
|
...process.env,
|
|
}
|
|
},
|
|
{
|
|
stderr: /spawn-worker-with-trace-exit\.js:17/
|
|
}
|
|
);
|