summaryrefslogtreecommitdiff
path: root/ruby/spawn.rb
blob: 8ee810aa378ab526f129e65d334e47a6b512b9e7 (plain)
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/env ruby


cmd = "for i in {1..30}; do echo '123456789'; done"
pipe_in, pipe_out = IO.pipe
pid = Process.spawn(cmd, :out => pipe_out, :err => pipe_out)
Process.wait pid
pipe_out.close
puts pipe_in.read