% cat spawn-cat.rb
#!/usr/bin/env ruby

require 'pty'

["The trees are bending over", "The cows are lying down"].each {|string| 
  PTY.spawn("cat -") do |r,w|
   tabit = string.gsub(/ +/, "\t")
   w.puts tabit
   foo =  r.gets.gsub(/\r\n/,"")
   puts "tabbendectomy" unless foo == tabit
  end
}


On OpenBSD (2.9) this prints:
% ./spawn-cat.rb
tabbendectomy
tabbendectomy
% ruby -v
ruby 1.6.5 (2001-09-19) [i386-openbsd2.9]

On Linux (redhat 7.1) , it is ok (prints nothing).
On Solaris (7) it just hangs.
I couldn't build ruby 1.6.5 on AIX (4.3) w/gcc

% make
....
compiling digest/rmd160
make[1]: Entering directory `/home/pete/tmp/ruby-1.6.5/ext/digest/rmd160'
/usr/ccs/bin/ld  -brtl -eInit_rmd160 -bI:/home/pete/tmp/ruby-1.6.5/ruby.imp \
-bM:SRE -T512 -H512 -lc -L/home/pete/tmp/ruby-1.6.5  -o rmd160.so rmd160.o \
rmd160hl.o rmd160init.o  -lc 
ld: 0711-317 ERROR: Undefined symbol: .__eprintf

  Pete
-- 
screwbean: a shrub or small tree found in the US Desert Southwest