Sha256: a7c8595721885fe0c41d8ae0f45081e770e47a74d79acec216b870b7c2acbf30

Contents?: true

Size: 796 Bytes

Versions: 42

Compression:

Stored size: 796 Bytes

Contents

require 'stringio'

class ThreadOut

  def initialize(out)
    @out = out
  end

  def write(stuff='')
    if Thread.current[:stdout] then
      Thread.current[:stdout].write stuff
    else
      @out.write stuff
    end
  end

  def puts(stuff='')
    if Thread.current[:stdout] then
      Thread.current[:stdout].puts stuff
    else
      @out.puts stuff
    end
  end
  
  def print(stuff='')
    if Thread.current[:stdout] then
      Thread.current[:stdout].puts stuff
    else
      @out.print stuff
    end
  end

  def flush
    if Thread.current[:stdout] then
      Thread.current[:stdout].flush
    else
      @out.flush
    end
  end
end

STDOUT.sync = true
STDERR.sync = true
$stdout = ThreadOut.new(STDOUT)
$stderr = ThreadOut.new(STDERR)

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
bake-toolkit-2.20.4 lib/common/ext/stdout.rb
bake-toolkit-2.20.3 lib/common/ext/stdout.rb
bake-toolkit-2.20.2 lib/common/ext/stdout.rb
bake-toolkit-2.20.1 lib/common/ext/stdout.rb
bake-toolkit-2.19.2 lib/common/ext/stdout.rb
bake-toolkit-2.19.1 lib/common/ext/stdout.rb
bake-toolkit-2.19.0 lib/common/ext/stdout.rb
bake-toolkit-2.18.0 lib/common/ext/stdout.rb
bake-toolkit-2.17.4 lib/common/ext/stdout.rb
bake-toolkit-2.17.3 lib/common/ext/stdout.rb
bake-toolkit-2.17.2 lib/common/ext/stdout.rb
bake-toolkit-2.17.1 lib/common/ext/stdout.rb
bake-toolkit-2.16.1 lib/common/ext/stdout.rb
bake-toolkit-2.15.0 lib/common/ext/stdout.rb
bake-toolkit-2.14.0 lib/common/ext/stdout.rb
bake-toolkit-2.13.1 lib/common/ext/stdout.rb
bake-toolkit-2.13.0 lib/common/ext/stdout.rb
bake-toolkit-2.12.2 lib/common/ext/stdout.rb
bake-toolkit-2.12.1 lib/common/ext/stdout.rb
bake-toolkit-2.12.0 lib/common/ext/stdout.rb