GeezerVison is showing github.com — process: fix omitting `--` from `process.execArgv` · nodejs/node@effe307
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/node_options-inl.h +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -253,7 +253,7 @@ struct ArgsInfo { |
253 | 253 | // on the command line (i.e. not generated through alias expansion). |
254 | 254 | // '--' is a special case here since its purpose is to end `exec_argv`, |
255 | 255 | // which is why we do not include it. |
256 | | - if (exec_args != nullptr && first() != "--") |
| 256 | + if (exec_args != nullptr && ret != "--") |
257 | 257 | exec_args->push_back(ret); |
258 | 258 | underlying->erase(underlying->begin() + 1); |
259 | 259 | } else { |
|
Collapse file
Copy file name to clipboardExpand all lines: test/parallel/test-process-exec-argv.js +13-10Lines changed: 13 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -27,16 +27,19 @@ const spawn = require('child_process').spawn; |
27 | 27 | if (process.argv[2] === 'child') { |
28 | 28 | process.stdout.write(JSON.stringify(process.execArgv)); |
29 | 29 | } else { |
30 | | - const execArgv = ['--stack-size=256']; |
31 | | - const args = [__filename, 'child', 'arg0']; |
32 | | - const child = spawn(process.execPath, execArgv.concat(args)); |
33 | | - let out = ''; |
| 30 | + for (const extra of [ [], [ '--' ] ]) { |
| 31 | + const execArgv = ['--stack-size=256']; |
| 32 | + const args = [__filename, 'child', 'arg0']; |
| 33 | + const child = spawn(process.execPath, [...execArgv, ...extra, ...args]); |
| 34 | + let out = ''; |
34 | 35 |
|
35 | | - child.stdout.on('data', function(chunk) { |
36 | | - out += chunk; |
37 | | - }); |
| 36 | + child.stdout.setEncoding('utf8'); |
| 37 | + child.stdout.on('data', function(chunk) { |
| 38 | + out += chunk; |
| 39 | + }); |
38 | 40 |
|
39 | | - child.on('close', function() { |
40 | | - assert.deepStrictEqual(JSON.parse(out), execArgv); |
41 | | - }); |
| 41 | + child.on('close', function() { |
| 42 | + assert.deepStrictEqual(JSON.parse(out), execArgv); |
| 43 | + }); |
| 44 | + } |
42 | 45 | } |