mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
Allow using Ctrl-D to quit the REPL
Without this, `std::getline` fails silently and this loops infinitely printing the prompt.
This commit is contained in:
parent
40c31fd1d1
commit
9a4c9940d5
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user