Merge pull request #6 from tekknolagi/main

Allow using Ctrl-D to quit the REPL
This commit is contained in:
BLUELOVETH 2023-02-09 11:40:39 +08:00 committed by GitHub
commit c19af0d9ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,9 @@ int main(int argc, char** argv){
while(true){ while(true){
(*vm->_stdout) << (need_more_lines ? "... " : ">>> "); (*vm->_stdout) << (need_more_lines ? "... " : ">>> ");
std::string line; std::string line;
std::getline(std::cin, line); if (!std::getline(std::cin, line)) {
break;
}
need_more_lines = pkpy_repl_input(repl, line.c_str()); need_more_lines = pkpy_repl_input(repl, line.c_str());
} }
pkpy_delete(vm); pkpy_delete(vm);