开发者

Trouble with threads in OSX and Ruby 1.9.2

开发者 https://www.devze.com 2023-04-09 09:44 出处:网络
Running the following code in IRB: t = Thread.new { loop { puts \'Hi\' } } I receive a single hi and then no more output.Only if I begin pressing the enter key do I receive output as expected until

Running the following code in IRB:

t = Thread.new { loop { puts 'Hi' } }

I receive a single hi and then no more output. Only if I begin pressing the enter key do I receive output as expected until I discontinue pressing enter.

If I do t.join, everything acts as expected

The problem happe开发者_运维知识库ns in IRB, pry and ripl using ruby 1.9.2-p180 and 1.9.2-p290 under rvm 1.8.0 in OSX 10.7 and rvm 1.6.20 in OSX 10.6

readline is installed via rvm pkg install readline

Thank you for any insight


Some versions of readline on OSX are blocking. If you experience the behavior above, you can disable readline by putting

IRB.conf[:USE_READLINE] = false

in .irbrc

0

精彩评论

暂无评论...
验证码 换一张
取 消