octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53412] KBHIT does not detect anything from co


From: Dave Goel
Subject: [Octave-bug-tracker] [bug #53412] KBHIT does not detect anything from command line, nor does it error out.
Date: Wed, 21 Mar 2018 20:05:37 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?53412>

                 Summary: KBHIT does not detect anything from command line,
nor does it error out.
                 Project: GNU Octave
            Submitted by: deego
            Submitted on: Thu 22 Mar 2018 12:05:36 AM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: deego
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.2
        Operating System: GNU/Linux

    _______________________________________________________

Details:

kbhit does not work from command line, nor does it error out. 

## From commandline, things like input() work and read the input. 
## When called from commandline, 'kbhit' does NOT appear to work at all! (as
illustrated below).
## octave --eval script.m  where script contains the code below. 

for ii=1:10;
  disp("Waiting 3 secs to read keypress.");
  pause(5);
  kk = kbhit(1);
  NumKK = numel(kk)  ## Always returns 0 even if you press a key. 
endfor

  

## Furthermore, if we wanted to work around it, we'd need to know from a
running octave whether we are being run from commandline, but there seems to
be no way to know. That is: 


## From a crontab, at least kbhit errors out when called, so that we can work
around it. try; kbhit(1); catch [tells us that we are not interactive, and use
something else.]

## But, from commandline, the above try catch does not fail either.


## If kbhit() won't work from command line, is there a way for a running
program to know that it won't work? (so that it may work around it).. 

## tried this on 4.2.2 on debian stable. 






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53412>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]