changeset 27046:758063af3d0c

maint: merge stable to default.
author Rik <rik@octave.org>
date Fri, 12 Apr 2019 13:15:34 -0700
parents 2e364bd8efb5 (current diff) 7894624afc47 (diff)
children 159402e52cfa
files libinterp/corefcn/sysdep.cc
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/sysdep.cc	Fri Apr 12 00:04:20 2019 +0000
+++ b/libinterp/corefcn/sysdep.cc	Fri Apr 12 13:15:34 2019 -0700
@@ -595,12 +595,16 @@
   {
 #if defined (HAVE__KBHIT) && defined (HAVE__GETCH)
     // This essentially means we are on a Windows system.
+
+    // The value to return when wait is false and no input is ready.
+    static constexpr int eof = std::istream::traits_type::eof ();
+
     int c;
 
     if (wait)
       c = _getch ();
     else
-      c = (! _kbhit ()) ? 0 : _getch ();
+      c = (! _kbhit ()) ? eof : _getch ();
 
 #else
     raw_mode (true, wait);