Add readStandardInput helper

This commit is contained in:
Alex Beregszaszi
2017-10-18 12:56:11 +01:00
parent 7186e142b8
commit 6f2865228c
4 changed files with 20 additions and 23 deletions
+2 -15
View File
@@ -430,14 +430,7 @@ void CommandLineInterface::readInputFilesAndConfigureRemappings()
m_allowedDirectories.push_back(boost::filesystem::path(path).remove_filename());
}
if (addStdin)
{
string s;
while (!cin.eof())
{
getline(cin, s);
m_sourceCodes[g_stdinFileName].append(s + '\n');
}
}
m_sourceCodes[g_stdinFileName] = dev::readStandardInput();
}
bool CommandLineInterface::parseLibraryOption(string const& _input)
@@ -731,13 +724,7 @@ bool CommandLineInterface::processInput()
if (m_args.count(g_argStandardJSON))
{
string input;
while (!cin.eof())
{
string tmp;
getline(cin, tmp);
input.append(tmp + "\n");
}
string input = dev::readStandardInput();
StandardCompiler compiler(fileReader);
cout << compiler.compile(input) << endl;
return true;