CommandLineParser: Replace global sout/serr streams with class members

- This removes the global variable and prevents stderr/stdout from being printed in tests
This commit is contained in:
Kamil Śliwak
2021-07-07 12:53:15 +02:00
parent ce11ebb687
commit 6c33fbcb6a
4 changed files with 58 additions and 40 deletions
+2 -2
View File
@@ -497,11 +497,11 @@ void CommandLineInterface::createJson(string const& _fileName, string const& _js
bool CommandLineInterface::parseArguments(int _argc, char const* const* _argv)
{
CommandLineParser parser;
CommandLineParser parser(sout(false), serr(false));
bool success = parser.parse(_argc, _argv, isatty(fileno(stdin)));
if (!success)
return false;
g_hasOutput = g_hasOutput || CommandLineParser::hasOutput();
g_hasOutput = g_hasOutput || parser.hasOutput();
m_options = parser.options();
return true;