Skip to content

Commit 48a8562

Browse files
himself65BridgeAR
authored andcommitted
src: fix SplitString to ignore white spaces
PR-URL: #26545 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Khaidi Chu <i@2333.moe>
1 parent de738a3 commit 48a8562

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/util.cc

+1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ std::vector<std::string> SplitString(const std::string& in, char delim) {
134134
while (in_stream.good()) {
135135
std::string item;
136136
std::getline(in_stream, item, delim);
137+
if (item.empty()) continue;
137138
out.emplace_back(std::move(item));
138139
}
139140
return out;

test/parallel/test-cli-node-options.js

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ tmpdir.refresh();
1414
const printA = require.resolve('../fixtures/printA.js');
1515
expect(`-r ${printA}`, 'A\nB\n');
1616
expect(`-r ${printA} -r ${printA}`, 'A\nB\n');
17+
expect(` -r ${printA} -r ${printA}`, 'A\nB\n');
18+
expect(` --require ${printA} --require ${printA}`, 'A\nB\n');
1719
expect('--no-deprecation', 'B\n');
1820
expect('--no-warnings', 'B\n');
1921
expect('--no_warnings', 'B\n');

0 commit comments

Comments
 (0)