diff options
Diffstat (limited to 'ruby/spawn.rb')
-rwxr-xr-x | ruby/spawn.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ruby/spawn.rb b/ruby/spawn.rb new file mode 100755 index 0000000..8ee810a --- /dev/null +++ b/ruby/spawn.rb @@ -0,0 +1,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 + |