Skip to content

Commit

Permalink
Also fix getline for analysis engine and genconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
lightvector committed Jun 14, 2020
1 parent 5c7e75c commit dad5c70
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
3 changes: 1 addition & 2 deletions cpp/command/analysis.cpp
Expand Up @@ -342,8 +342,7 @@ int MainCmds::analysis(int argc, const char* const* argv) {

string line;
json input;
while(cin) {
getline(cin,line);
while(getline(cin,line)) {
line = Global::trim(line);
if(line.length() == 0)
continue;
Expand Down
13 changes: 10 additions & 3 deletions cpp/command/benchmark.cpp
Expand Up @@ -462,9 +462,13 @@ int MainCmds::genconfig(int argc, const char* const* argv, const char* firstComm
try {
cout << prompt << std::flush;
string line;
std::getline(std::cin, line);
parse(Global::trim(line));
break;
if(std::getline(std::cin, line)) {
parse(Global::trim(line));
break;
}
else {
break;
}
}
catch(const StringError& err) {
string what = err.what();
Expand All @@ -473,6 +477,9 @@ int MainCmds::genconfig(int argc, const char* const* argv, const char* firstComm
cout << err.what() << endl;
}
}
if(!std::cin) {
throw StringError("Stdin was closed - failing and not generating a config");
}
};

auto parseYN = [](const string& line, bool& b) {
Expand Down
6 changes: 1 addition & 5 deletions cpp/command/gtp.cpp
Expand Up @@ -1391,11 +1391,7 @@ int MainCmds::gtp(int argc, const char* const* argv) {

bool currentlyAnalyzing = false;
string line;
while(cin) {
getline(cin,line);
if(!cin)
break;

while(getline(cin,line)) {
//Parse command, extracting out the command itself, the arguments, and any GTP id number for the command.
string command;
vector<string> pieces;
Expand Down

0 comments on commit dad5c70

Please sign in to comment.