★ wanayoo — archive 1999 https://github.com/nodejs/node/commit/effe30777bNouvelle recherche | Portail wanayoo
Skip to content
Permalink
Browse files

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: #24647

PR-URL: #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>
  • Loading branch information...
addaleax authored and targos committed Nov 26, 2018
1 parent 1035e36 commit effe30777b6744272ea2d08989321f51e98b29cf
Showing with 14 additions and 11 deletions.
  1. +1 −1 src/node_options-inl.h
  2. +13 −10 test/parallel/test-process-exec-argv.js
@@ -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);
});
}
}

0 comments on commit effe307

Please sign in to comment.
You can’t perform that action at this time.