RadRails

RadRails



[Copy to clipboard] [ - ]
请参考FAQ就知道了


Why aren't my output statements appearing?

If a user runs code such as:


puts "gimme your name:"
name = gets.chomp
puts "hello, #{name}"
You won't see the "gimme your name", before being prompted for input (name = gets.chomp) first. After the input, the two puts lines are printed out. This is a result of the way streams are handled.
There's a couple solutions. The first is to manually flush the stream after each put. The second is to set:

$stdout.sync = true


[Copy to clipboard] [ - ]