From: Jorge Gorbe Moya Date: Tue, 24 Jun 2008 10:36:01 +0000 (+0200) Subject: closing stdin closes test_core now X-Git-Tag: v0.1~47 X-Git-Url: http://slack.codemaniacs.com/git/?a=commitdiff_plain;h=97a2656dca8c40860c9eb64136e6ba4c042c7333;p=wenboi.git closing stdin closes test_core now --- diff --git a/tests/test_core.cc b/tests/test_core.cc index 2d31c89..9825de9 100644 --- a/tests/test_core.cc +++ b/tests/test_core.cc @@ -23,14 +23,14 @@ int main(int argc, char **argv) cout << gb.status_string() << endl; - bool exit_program=false; string line, command, last_command; vector arguments; - while(!exit_program) + while(true) { cout << "(wenboi) "; std::getline(cin, line, '\n'); + if (!cin.good()) break; // if stdin is closed, exit main loop if (line == "") command = last_command; else { @@ -55,7 +55,7 @@ int main(int argc, char **argv) } else if (command == "quit") { - exit_program = true; + break; } else if (command == "disasm") {