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

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

[Octave-bug-tracker] [bug #41315] pause(): every other call fails


From: Rik
Subject: [Octave-bug-tracker] [bug #41315] pause(): every other call fails
Date: Thu, 23 Jan 2014 00:24:28 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0

Update of bug #41315 (project octave):

                  Status:                    None => Confirmed              

    _______________________________________________________

Follow-up Comment #2:

This works perfectly on a Linux platform, but fails in both the CLI and GUI
versions on a Windows platform.  It seems that this is likely due to the
difference in tty standards between a POSIX O/S like Linux and Microsoft's own
implementations.

The relevant routine is octave_kbhit in libinterp/corefcn/sysdep.cc.


int
octave_kbhit (bool wait)
{
#ifdef HAVE__KBHIT
  int c = (! wait && ! _kbhit ()) ? 0 : std::cin.get ();
#else
  raw_mode (true, wait);

  // Get current handler.
  octave_interrupt_handler saved_interrupt_handler
    = octave_ignore_interrupts ();

  // Restore it, disabling system call restarts (if possible) so the
  // read can be interrupted.

  octave_set_interrupt_handler (saved_interrupt_handler, false);

  int c = std::cin.get ();

  if (std::cin.fail () || std::cin.eof ())
    std::cin.clear ();

  // Restore it, enabling system call restarts (if possible).
  octave_set_interrupt_handler (saved_interrupt_handler, true);

  raw_mode (false, true);
#endif

  return c;
}


On my system I HAVE__KBHIT is unset so the #else branch is being used.

Another easy way to see the problem is to directly use the kbhit function.  It
should grab a single character, but instead is waiting for a <RETURN> key.


x = kbhit ()


Finally, it looks like the raw_mode() function is possibly the root cause as
it tries to fiddle with the terminal properties.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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