bugGNU Octave - Bugs: bug #48541, kbhit returns...

 
 

bug #48541: kbhit returns "undefined" when starting script from terminal

Submitted by:  None
Submitted on:  Sun 17 Jul 2016 11:34:24 AM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: MarcOriginator Email: -unavailable-
Open/Closed: ClosedRelease: dev
Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 18 Jul 2016 06:44:55 PM UTC, comment #5:

Alright, sounds good to me, pushed this fix on default,

http://hg.savannah.gnu.org/hgweb/octave/rev/ed6104a78ebf

Mike Miller <mtmiller>
Project Administrator
Mon 18 Jul 2016 06:32:59 PM UTC, comment #4:

If it is never meant to be used in batch mode, maybe kbhit should just return immediately with an empty value? At least that would be a sensible position, even if people don't particularly like it.

Rik <rik5>
Project Administrator
Mon 18 Jul 2016 06:17:21 PM UTC, comment #3:

Oh, now I see that the kbhit function is simply looking at Octave's "interactive" flag.

That flag is set to false when running batch commands. So what should kbhit return when run in a batch context? Should kbhit behave differently when piping input to Octave via stdin versus using --eval?

Mike Miller <mtmiller>
Project Administrator
Mon 18 Jul 2016 05:45:19 PM UTC, comment #2:

I see this behavior even when run as

This would normally work around any problems of setting up Octave without readline or without terminal initialization. It looks like it might be something that hasn't been set up yet at the point when the --eval strings are processed.

Mike Miller <mtmiller>
Project Administrator
Mon 18 Jul 2016 02:24:20 PM UTC, comment #1:

Confirmed. This is probably because scripts run on the command line are usually intended to do batch processing and so no connection is made to an input console. This affects the current development branch as well.

Rik <rik5>
Project Administrator
Sun 17 Jul 2016 11:34:24 AM UTC, original submission:

I use kbhit for user interaction.

For example (cf. attached showcase.m):

When I run the script from within octave everything is fine.
But when I run the same script from the terminal by issuing
I get the following error: "error: value on right hand side of assignment is undefined"

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #37920:  showcase.m added by None (13B - text/x-objcsrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 18 Jul 2016 06:44:55 PM UTCmtmillerStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Mon 18 Jul 2016 02:24:19 PM UTCrik5Item GroupSegfault, Bus Error, etc.=>Incorrect Result
      StatusNone=>Confirmed
      Release4.0.0=>dev
    Sun 17 Jul 2016 11:34:24 AM UTCNoneAttached File-=>Added showcase.m, #37920

    Back to the top


    Powered by Savane 3.1-cleanup1