process: fix omitting --
from process.execArgv
This was essentially a typo that went unnoticed because we didn’t have tests for this particular situation. Fixes: https://github.com/nodejs/node/issues/24647 PR-URL: https://github.com/nodejs/node/pull/24654 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
This commit is contained in:
parent
9efcfd313a
commit
83d6cb98ec
@ -253,7 +253,7 @@ struct ArgsInfo {
|
||||
// on the command line (i.e. not generated through alias expansion).
|
||||
// '--' is a special case here since its purpose is to end `exec_argv`,
|
||||
// which is why we do not include it.
|
||||
if (exec_args != nullptr && first() != "--")
|
||||
if (exec_args != nullptr && ret != "--")
|
||||
exec_args->push_back(ret);
|
||||
underlying->erase(underlying->begin() + 1);
|
||||
} else {
|
||||
|
@ -27,16 +27,19 @@ const spawn = require('child_process').spawn;
|
||||
if (process.argv[2] === 'child') {
|
||||
process.stdout.write(JSON.stringify(process.execArgv));
|
||||
} else {
|
||||
const execArgv = ['--stack-size=256'];
|
||||
const args = [__filename, 'child', 'arg0'];
|
||||
const child = spawn(process.execPath, execArgv.concat(args));
|
||||
let out = '';
|
||||
for (const extra of [ [], [ '--' ] ]) {
|
||||
const execArgv = ['--stack-size=256'];
|
||||
const args = [__filename, 'child', 'arg0'];
|
||||
const child = spawn(process.execPath, [...execArgv, ...extra, ...args]);
|
||||
let out = '';
|
||||
|
||||
child.stdout.on('data', function(chunk) {
|
||||
out += chunk;
|
||||
});
|
||||
child.stdout.setEncoding('utf8');
|
||||
child.stdout.on('data', function(chunk) {
|
||||
out += chunk;
|
||||
});
|
||||
|
||||
child.on('close', function() {
|
||||
assert.deepStrictEqual(JSON.parse(out), execArgv);
|
||||
});
|
||||
child.on('close', function() {
|
||||
assert.deepStrictEqual(JSON.parse(out), execArgv);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user