Search code examples
rubyeditorscite

SciTE can't flush output pane until program exit


SciTE version is 2.25.

I have some ruby code to test it.

def foo
  puts "hello"
  sleep 5
  puts "world"
end

puts foo

SciTE's output pane will show this:

>ruby scite.rb

And 5 seconds later print:

hello
world

>Exit code: 0

It's not correct and I remember the previous version SciTE is right. Why?


Solution

  • Try putting STDOUT.sync = true at the beginning of your program. I'm neither a Windows nor SciTE user, but I know that some of our students at Rubylearning had similar problems and apparently that was the fix (or manual calls to flush after outputting something).