Read from stdin only if - is explicitly given

This commit is contained in:
Leonardo Alt
2018-05-07 09:32:46 +02:00
parent dc857feb4f
commit db5ea8ec03
2 changed files with 43 additions and 10 deletions
+6 -3
View File
@@ -404,9 +404,7 @@ bool CommandLineInterface::readInputFilesAndConfigureRemappings()
{
bool ignoreMissing = m_args.count(g_argIgnoreMissingFiles);
bool addStdin = false;
if (!m_args.count(g_argInputFile))
addStdin = true;
else
if (m_args.count(g_argInputFile))
for (string path: m_args[g_argInputFile].as<vector<string>>())
{
auto eq = find(path.begin(), path.end(), '=');
@@ -450,6 +448,11 @@ bool CommandLineInterface::readInputFilesAndConfigureRemappings()
}
if (addStdin)
m_sourceCodes[g_stdinFileName] = dev::readStandardInput();
if (m_sourceCodes.size() == 0)
{
cerr << "No input files given. If you wish to use the standard input please specify \"-\" explicity." << endl;
return false;
}
return true;
}