Skip to content

Commit

Permalink
src: fix SplitString to ignore white spaces
Browse files Browse the repository at this point in the history
PR-URL: nodejs#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>
  • Loading branch information
himself65 authored and BridgeAR committed Mar 14, 2019
1 parent a9fdaef commit 2733e2d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ std::vector<std::string> SplitString(const std::string& in, char delim) {
while (in_stream.good()) {
std::string item;
std::getline(in_stream, item, delim);
if (item.empty()) continue;
out.emplace_back(std::move(item));
}
return out;
Expand Down
2 changes: 2 additions & 0 deletions test/parallel/test-cli-node-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ tmpdir.refresh();
const printA = require.resolve('../fixtures/printA.js');
expect(`-r ${printA}`, 'A\nB\n');
expect(`-r ${printA} -r ${printA}`, 'A\nB\n');
expect(` -r ${printA} -r ${printA}`, 'A\nB\n');
expect(` --require ${printA} --require ${printA}`, 'A\nB\n');
expect('--no-deprecation', 'B\n');
expect('--no-warnings', 'B\n');
expect('--no_warnings', 'B\n');
Expand Down

0 comments on commit 2733e2d

Please sign in to comment.