require 'rubygems' require 'systemu' threads = [] (ARGV.shift || 10).to_i.times do t = Thread.new do status, stdout, stderr = systemu 'cat', :stdin => ('42' * 1024) [status, stdout[0..15]] end threads << t end threads.map{|t| p t.value}