diff libinterp/corefcn/sysdep.cc @ 27011:c3716220d5b9 stable

fix pause and kbhit with glibc 2.28 end-of-file state behavior (bug #55029) * sysdep.cc (octave::kbhit): Call "clearerr (stdin)" on end-of-file condition in addition to "std::cin.clear ()". In glibc 2.28, end-of-file is persistent and must be cleared by the application.
author Mike Miller <mtmiller@octave.org>
date Tue, 02 Apr 2019 13:56:16 -0700
parents 98afb8bbd1f6
children 762bfd9fad94 7894624afc47
line wrap: on
line diff
--- a/libinterp/corefcn/sysdep.cc	Mon Apr 01 14:48:03 2019 -0700
+++ b/libinterp/corefcn/sysdep.cc	Tue Apr 02 13:56:16 2019 -0700
@@ -566,7 +566,10 @@
     int c = std::cin.get ();
 
     if (std::cin.fail () || std::cin.eof ())
-      std::cin.clear ();
+      {
+        std::cin.clear ();
+        clearerr (stdin);
+      }
 
     // Restore it, enabling system call restarts (if possible).
     octave::set_interrupt_handler (saved_interrupt_handler, true);