Explorar o código

Merge pull request #6 from tekknolagi/main

Allow using Ctrl-D to quit the REPL
BLUELOVETH %!s(int64=3) %!d(string=hai) anos
pai
achega
c19af0d9ee
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      src/main.cpp

+ 3 - 1
src/main.cpp

@@ -30,7 +30,9 @@ int main(int argc, char** argv){
         while(true){
             (*vm->_stdout) << (need_more_lines ? "... " : ">>> ");
             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());
         }
         pkpy_delete(vm);