开发者

Aptana 3 Studio's debug console delays output until script termination

I've installed Aptana Studio 3.0.1 as an eclipse plugin and ruby 1.9.2p180. When I run a ruby script from Aptana and track its execution on th开发者_JAVA技巧e debug console, it delays the output until script finalization.

Here is a simple code example:

puts "Hello world!"
print "Enter a phrase: "
puts gets

When I run this program on Aptana, I get this output

Test
Hello world!
Enter a phrase: Test

But running it on ruby interpreter gives me a different result:

ruby test.rb

Hello world!
Enter a phrase: Test
Test

The latter is the correct output.

What's happening? Maybe I found a bug in Aptana or is it due to a misconfiguration?


Well there's two explanations:

  1. There was a bug that could cause this in 3.0.0. (See http://jira.appcelerator.org/browse/APSTUD-806 and http://jira.appcelerator.org/browse/APSTUD-2088 ). Those should have been fixed in 3.0.1, so that may not be the cause.
  2. Ruby sometimes buffers up output to STDERR/STDOUT (specifically on Windows we tend to see this). You can force them to flush by adding the following in your code:

    STDERR.sync = true
    STDOUT.sync = true
    

    There was a fix in 3.0.2 where we silently do this for you: http://jira.appcelerator.org/browse/APSTUD-2355

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜