summaryrefslogtreecommitdiff
path: root/ruby/proc-in-out-in-out.rb
blob: 645d620499c11c5369e5ce58489aa8dda2095137 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env ruby

require 'expect'
require 'open3'

Open3.popen3("/bin/bash") do
    | input, output, error, wait_thr |
    input.sync = true
    output.sync = true

    input.puts "ls /tmp"
    puts output.expect("\n", 5)

    input.puts "ls /etc"
    puts output.expect("\n", 5)
end