force output during long process

B

bwv549

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
 
C

Chris Shea

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,264
Messages
2,571,322
Members
48,005
Latest member
ChasityFan

Latest Threads

Top