Sha256: 10ac4a326f28c0bd460bd4fbfa8af21c4e335b0cd6cac871dfed33137efc95da
Contents?: true
Size: 792 Bytes
Versions: 18
Compression:
Stored size: 792 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
18 entries across 18 versions & 1 rubygems