Skip to content

Commit fad0867

Browse files
author
MarcoFalke
committed
Cleanup -includeconf error message
Remove the erroneous trailing newline '\n'. Also, print only the first value to remove needless redundancy in the error message.
1 parent fa9f711 commit fad0867

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/util/system.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,14 +366,12 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin
366366
}
367367

368368
// we do not allow -includeconf from command line
369-
bool success = true;
370369
if (auto* includes = util::FindKey(m_settings.command_line_options, "includeconf")) {
371-
for (const auto& include : util::SettingsSpan(*includes)) {
372-
error += "-includeconf cannot be used from commandline; -includeconf=" + include.write() + "\n";
373-
success = false;
374-
}
370+
const auto& include{*util::SettingsSpan(*includes).begin()}; // pick first value as example
371+
error = "-includeconf cannot be used from commandline; -includeconf=" + include.write();
372+
return false;
375373
}
376-
return success;
374+
return true;
377375
}
378376

379377
std::optional<unsigned int> ArgsManager::GetArgFlags(const std::string& name) const

test/functional/feature_includeconf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def run_test(self):
4747
expected_msg='Error: Error parsing command line arguments: -includeconf cannot be used from commandline; -includeconf=true',
4848
)
4949
self.nodes[0].assert_start_raises_init_error(
50-
extra_args=['-includeconf=relative2.conf'],
50+
extra_args=['-includeconf=relative2.conf', '-includeconf=no_warn.conf'],
5151
expected_msg='Error: Error parsing command line arguments: -includeconf cannot be used from commandline; -includeconf="relative2.conf"',
5252
)
5353

0 commit comments

Comments
 (0)