GeezerVison is showing github.com — src: fix NODE_OPTIONS parsing bug · nodejs/node@2c5dfef
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.cc +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -2921,7 +2921,8 @@ void Init(std::vector<std::string>* argv, |
2921 | 2921 | index = node_options.find(' ', index + 1); |
2922 | 2922 | if (index - prev_index == 1) continue; |
2923 | 2923 |
|
2924 | | - const std::string option = node_options.substr(prev_index + 1, index); |
| 2924 | + const std::string option = node_options.substr( |
| 2925 | + prev_index + 1, index - prev_index - 1); |
2925 | 2926 | if (!option.empty()) |
2926 | 2927 | env_argv.emplace_back(std::move(option)); |
2927 | 2928 | } while (index != std::string::npos); |
|
Collapse file
Copy file name to clipboardExpand all lines: test/parallel/test-cli-node-options.js +6-1Lines changed: 6 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -14,7 +14,9 @@ const tmpdir = require('../common/tmpdir'); |
14 | 14 | tmpdir.refresh(); |
15 | 15 | process.chdir(tmpdir.path); |
16 | 16 |
|
17 | | -expect(`-r ${require.resolve('../fixtures/printA.js')}`, 'A\nB\n'); |
| 17 | +const printA = require.resolve('../fixtures/printA.js'); |
| 18 | +expect(`-r ${printA}`, 'A\nB\n'); |
| 19 | +expect(`-r ${printA} -r ${printA}`, 'A\nB\n'); |
18 | 20 | expect('--no-deprecation', 'B\n'); |
19 | 21 | expect('--no-warnings', 'B\n'); |
20 | 22 | expect('--trace-warnings', 'B\n'); |
@@ -29,6 +31,9 @@ expect('--v8-pool-size=10', 'B\n'); |
29 | 31 | expect('--trace-event-categories node', 'B\n'); |
30 | 32 | // eslint-disable-next-line no-template-curly-in-string |
31 | 33 | expect('--trace-event-file-pattern {pid}-${rotation}.trace_events', 'B\n'); |
| 34 | +// eslint-disable-next-line no-template-curly-in-string |
| 35 | +expect('--trace-event-file-pattern {pid}-${rotation}.trace_events ' + |
| 36 | + '--trace-event-categories node.async_hooks', 'B\n'); |
32 | 37 |
|
33 | 38 | if (!common.isWindows) { |
34 | 39 | expect('--perf-basic-prof', 'B\n'); |
|