mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
Reserve exec argv storage before inserting configured and CLI-expanded arguments so vector reallocation cannot invalidate pointers in argv. Signed-off-by: Archkon <180910180+Archkon@users.noreply.github.com> PR-URL: https://github.com/nodejs/node/pull/64755 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Aviv Keller <me@aviv.sh>
42 lines
1021 B
JavaScript
42 lines
1021 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
|
|
const {
|
|
generateSEA,
|
|
skipIfSingleExecutableIsNotSupported,
|
|
} = require('../common/sea');
|
|
|
|
skipIfSingleExecutableIsNotSupported();
|
|
|
|
// This tests the execArgvExtension "cli" mode in single executable applications.
|
|
|
|
const tmpdir = require('../common/tmpdir');
|
|
const { spawnSyncAndAssert } = require('../common/child_process');
|
|
const { join } = require('path');
|
|
const fixtures = require('../common/fixtures');
|
|
|
|
tmpdir.refresh();
|
|
|
|
const outputFile = generateSEA(fixtures.path('sea', 'exec-argv-extension-cli'));
|
|
|
|
// Test that --node-options works with execArgvExtension: "cli"
|
|
spawnSyncAndAssert(
|
|
outputFile,
|
|
[
|
|
'--node-options=--no-warnings --max-old-space-size=1024',
|
|
'user-arg1',
|
|
'user-arg2',
|
|
],
|
|
{
|
|
env: {
|
|
...process.env,
|
|
NODE_OPTIONS: '--max-old-space-size=2048', // Should be ignored
|
|
COMMON_DIRECTORY: join(__dirname, '..', 'common'),
|
|
NODE_DEBUG_NATIVE: 'SEA',
|
|
},
|
|
},
|
|
{
|
|
stdout: /execArgvExtension cli test passed/,
|
|
});
|