Skip to content

Commit

Permalink
Bugfix: Don’t call Ncurses.getch when in shell_out mode
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stapelberg authored and rlane committed Feb 27, 2010
1 parent c2f8184 commit aaa384a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/sup/buffer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ def nonblocking_getch
## 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

Expand Down Expand Up @@ -218,6 +224,7 @@ def sigwinch_happened!; @sigwinch_mutex.synchronize { @sigwinch_happened = true
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
Expand Down

0 comments on commit aaa384a

Please sign in to comment.