fedzor
7/15/2008 9:17:00 PM
On Jul 15, 2008, at 5:09 PM, Janus Bor wrote:
> Hi everyone!
>
> I'm trying to do something like this:
>
> print "Processing... "
>
> #some fancy code that takes ages, or maybe:
> sleep(3)
>
> print "done\n"
>
>
> I was expecting to get the following output on my console:
>
> Processing... [and after 3 secs:]done
>
> However, the script first waits 3 seconds and then writes the whole
> line
> at once.
Try this:
print "Processing... "
STDOUT.flush
sleep 3
puts "done"
STDOUT#flush will ensure that everything in the buffer will be
printed, there and then
~ Ari
English is like a pseudo-random number generator - there are a
bajillion rules to it, but nobody cares.