1
0
Fork 0
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:
naruse 2013-04-13 21:39:23 +00:00
parent dfdbfb6d5f
commit 03eab41dfb

View file

@ -22,6 +22,7 @@ include Curses
init_screen
begin
result = Timeout.timeout(#{timeout}) do
print "!"
#{src}
end
rescue Exception => e
@ -32,6 +33,11 @@ ensure
$stdio.flush
end
src
wait = r.readpartial(1)
if wait != "!"
wait << r.readpartial(1000)
raise wait
end
if input
w.print(input)
w.flush