changeset 25311:10ec5795bd06 stable

allow kbhit to work in command-line scripts (bug #53412) * sysdep.cc (Fkbhit): Don't limit function to "interactive" applications.
author John W. Eaton <jwe@octave.org>
date Wed, 25 Apr 2018 16:09:23 -0400
parents 0b253ba6eb91
children 586d6932b119
files libinterp/corefcn/sysdep.cc
diffstat 1 files changed, 6 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/sysdep.cc	Wed Apr 25 10:23:22 2018 -0400
+++ b/libinterp/corefcn/sysdep.cc	Wed Apr 25 16:09:23 2018 -0400
@@ -1026,25 +1026,18 @@
 @seealso{input, pause}
 @end deftypefn */)
 {
-  octave_value retval = "";
-
   // FIXME: add timeout and default value args?
 
-  if (octave::application::interactive ())
-    {
-      Fdrawnow ();
+  Fdrawnow ();
 
-      int c = octave_kbhit (args.length () == 0);
+  int c = octave_kbhit (args.length () == 0);
 
-      if (c == -1)
-        c = 0;
-
-      char s[2] = { static_cast<char> (c), '\0' };
+  if (c == -1)
+    c = 0;
 
-      retval = s;
-    }
+  char s[2] = { static_cast<char> (c), '\0' };
 
-  return retval;
+  return octave_value (s);
 }
 
 DEFUN (pause, args, ,