Mercurial > octave
changeset 27045:7894624afc47 stable
Fix pause() with no arguments called on Windows (bug #55943)
* sysdep.cc (kbhit): Declare new static variable eof to hold the EOF value from
std::istream. Return eof value, instead of 0, if there is no character to be
read from keyboard.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Fri, 12 Apr 2019 13:11:50 -0700 |
parents | 6caf75200854 |
children | 758063af3d0c 66fa9ebb0c3e |
files | libinterp/corefcn/sysdep.cc |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/sysdep.cc Thu Apr 11 08:48:43 2019 -0700 +++ b/libinterp/corefcn/sysdep.cc Fri Apr 12 13:11:50 2019 -0700 @@ -544,12 +544,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);