STDIN.getc 锁定我的应用程序
我有以下代码
class TimeReport
def run
init_screen
lines = Curses::lines
cols = Curses::cols
read=""
begin
crmode
noecho
gotoDay diaActual.data.to_s #loads the screen with data
while !read.eql?("q")
printPrompt #simply prints the command prompt
read=STDIN.getc
printOnSpot 10,10,read.to_s #prints what was read
if(!read.empty? && !read.strip.empty?)
processPrompt(read,@ecra) # process the read command
else
printInfo "Say What??"
end
end
ensure
echo
nocrmode
close_screen
end
end
end
TimeReport.new.run
当我尝试运行应用程序时,应用程序锁定并且不初始化屏幕。 如果我使用 Curses.getch 就不会出现此问题。
谁能告诉我为什么会发生这种情况? 以及解决问题的方法?
I have the following code
class TimeReport
def run
init_screen
lines = Curses::lines
cols = Curses::cols
read=""
begin
crmode
noecho
gotoDay diaActual.data.to_s #loads the screen with data
while !read.eql?("q")
printPrompt #simply prints the command prompt
read=STDIN.getc
printOnSpot 10,10,read.to_s #prints what was read
if(!read.empty? && !read.strip.empty?)
processPrompt(read,@ecra) # process the read command
else
printInfo "Say What??"
end
end
ensure
echo
nocrmode
close_screen
end
end
end
TimeReport.new.run
When i try running the application the application locks and doesnt init the screen.
If i use Curses.getch this issue doesn't occur.
Can anyone enlighten me as to why this happens? and ways to fix the issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是为什么你不应该混合使用 Curses 和 STDIN
And this is why you shouldn't mix Curses and STDIN