summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-11-26 19:40:09 +0900
committerRich Trott <rtrott@gmail.com>2018-11-29 11:18:39 -0800
commit83d6cb98ecf6efc0792b174265a4580b31f4b3eb (patch)
treebef773a862eee0add454ff1c70863bb609a0738b /test
parent9efcfd313ad965f04d26abe33468569a82815485 (diff)
downloadandroid-node-v8-83d6cb98ecf6efc0792b174265a4580b31f4b3eb.tar.gz
android-node-v8-83d6cb98ecf6efc0792b174265a4580b31f4b3eb.tar.bz2
android-node-v8-83d6cb98ecf6efc0792b174265a4580b31f4b3eb.zip
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>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-process-exec-argv.js23
1 files changed, 13 insertions, 10 deletions
diff --git a/test/parallel/test-process-exec-argv.js b/test/parallel/test-process-exec-argv.js
index fec5699933..578ee7b5d1 100644
--- a/test/parallel/test-process-exec-argv.js
+++ b/test/parallel/test-process-exec-argv.js
@@ -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);
+ });
+ }
}