7655cbd
diff -up octave-4.4.1/libinterp/corefcn/sysdep.cc.eof octave-4.4.1/libinterp/corefcn/sysdep.cc
7655cbd
--- octave-4.4.1/libinterp/corefcn/sysdep.cc.eof	2019-05-06 21:43:06.906724728 -0600
7655cbd
+++ octave-4.4.1/libinterp/corefcn/sysdep.cc	2019-05-06 21:44:58.445306461 -0600
7655cbd
@@ -559,7 +559,10 @@ octave_kbhit (bool wait)
7655cbd
   int c = std::cin.get ();
7655cbd
 
7655cbd
   if (std::cin.fail () || std::cin.eof ())
7655cbd
-    std::cin.clear ();
7655cbd
+    {
7655cbd
+      std::cin.clear ();
7655cbd
+      clearerr (stdin);
7655cbd
+    }
7655cbd
 
7655cbd
   // Restore it, enabling system call restarts (if possible).
7655cbd
   octave::set_interrupt_handler (saved_interrupt_handler, true);