From: Robert Klemme Date: 2010-04-30T01:03:09+09:00 Subject: Re: Use of STDOUT.flush after puts 2010/4/29 Alex DeCaria : > Thanks everyone.  That is very helpful.  My remaining questions is "Why > isn't Ruby's default state such that STDOUT.sync is always 'true'?  In > other words, what's the advantage of having standard output buffered > rather than instantaneous?  In every program I've written in Ruby I've > always wanted anything written to standard output to appear > instantaneously. Maybe because it is more efficient for the general case and there might not be a reliable platform independent way to detect the type of output (terminal, file, pipe...). Btw, different Ruby implementations seem to not agree on the default value: 18:00:33 ~$ allruby -e 'p $stdout.sync' CYGWIN_NT-5.1 padrklemme1 1.7.5(0.225/5/3) 2010-04-12 19:07 i686 Cygwin ======================================== ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin] false ======================================== ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-cygwin] false ======================================== jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-02 69fbfa3) (Java HotSpot(TM) Client VM 1.6.0_20) [x86-java] true 18:01:14 ~$ Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/