[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

force output during long process

bwv549

9/6/2007 8:00:00 PM

I'm running a long process and need to give some feedback to the user
(command line program). Is there some way to force output at a given
step of execution? Many times it seems that the output is spooled and
then printed to the screen all at once.

e.g.:

# ... inside some_very_long_program
puts "working..." # needs to display here and not spool it until
later

Thanks

1 Answer

Chris Shea

9/6/2007 8:52:00 PM

0

On Sep 6, 2:00 pm, bwv549 <jtpri...@gmail.com> wrote:
> I'm running a long process and need to give some feedback to the user
> (command line program). Is there some way to force output at a given
> step of execution? Many times it seems that the output is spooled and
> then printed to the screen all at once.
>
> e.g.:
>
> # ... inside some_very_long_program
> puts "working..." # needs to display here and not spool it until
> later
>
> Thanks

To flush the buffer, use $stdout.flush
To not use a buffer at all, use $stdout.sync = true

HTH,
Chris