commit aaa384af6ec7054f5e16086b1e54b8f3740723a6
parent c2f8184f05d38bc3c447c004c93c1df34955a7a5
Author: Michael Stapelberg <michael@stapelberg.de>
Date: Fri, 19 Feb 2010 04:20:49 +0100
Bugfix: Don’t call Ncurses.getch when in shell_out mode
Previously, when using threads, Ncurses.getch was called while
the gpg pinentry was running (as an example of using the shell_out
method). Now, the Ncurses mutex will be used to wait until shell_out
mode is finished.
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
@@ -38,7 +38,13 @@ module Ncurses
## background threads will be BLOCKED. (except in very modern versions
## of libncurses-ruby. the current one on ubuntu seems to work well.)
if IO.select([$stdin], nil, nil, 0.5)
- c = Ncurses.getch
+ if Redwood::BufferManager.shelled?
+ # If we get input while we're shelled, we'll ignore it for the
+ # moment and use Ncurses.sync to wait until the shell_out is done.
+ Ncurses.sync { nil }
+ else
+ Ncurses.getch
+ end
end
end
@@ -218,6 +224,7 @@ EOS
def sigwinch_happened?; @sigwinch_mutex.synchronize { @sigwinch_happened } end
def buffers; @name_map.to_a; end
+ def shelled?; @shelled; end
def focus_on buf
return unless @buffers.member? buf