CLI: startInteractive(): Handle bad()/eof()

This commit is contained in:
Albert S. 2021-09-26 17:33:46 +02:00
parent 95c5c4e155
commit 57c28b2426

10
cli.cpp
View File

@ -205,6 +205,16 @@ void CLI::startInteractive()
std::cout << "> "; std::cout << "> ";
std::getline(std::cin, input); std::getline(std::cin, input);
if(std::cin.bad() || std::cin.eof())
{
std::cout << "Exiting" << std::endl;
return;
}
if(input.empty())
{
continue;
}
std::vector<std::string> splitted = utils::split(input, "\\s+"); std::vector<std::string> splitted = utils::split(input, "\\s+");
if(splitted.empty()) if(splitted.empty())
{ {