mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Send input after curses is ready or raise error
On Linux, ncurses's initscr aborts with showing "Error opening terminal: unknown.". This fix can catch the error message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
dfdbfb6d5f
commit
03eab41dfb
1 changed files with 6 additions and 0 deletions
|
@ -22,6 +22,7 @@ include Curses
|
||||||
init_screen
|
init_screen
|
||||||
begin
|
begin
|
||||||
result = Timeout.timeout(#{timeout}) do
|
result = Timeout.timeout(#{timeout}) do
|
||||||
|
print "!"
|
||||||
#{src}
|
#{src}
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
|
@ -32,6 +33,11 @@ ensure
|
||||||
$stdio.flush
|
$stdio.flush
|
||||||
end
|
end
|
||||||
src
|
src
|
||||||
|
wait = r.readpartial(1)
|
||||||
|
if wait != "!"
|
||||||
|
wait << r.readpartial(1000)
|
||||||
|
raise wait
|
||||||
|
end
|
||||||
if input
|
if input
|
||||||
w.print(input)
|
w.print(input)
|
||||||
w.flush
|
w.flush
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue