rev_thread_spawn: make 1.9 TeeInput performance tolerable
[rainbows.git] / t / bin / utee
blobe48f307fd3ef99cc90f6e3d3afb74262095e4c1c
1 #!/usr/bin/env ruby
2 # tee(1) as distributed on most(all?) systems is buffered in luserspace
3 # this only does unbuffered writes (with line-buffered input) to make
4 # test output appear in real-time
5 # -*- encoding: binary -*-
6 $stdin.binmode
7 $stdout.binmode
8 fp = File.open(ARGV.shift, "wb")
9 $stdin.each_line do |line|
10 fp.syswrite line
11 $stdout.syswrite line
12 end