diff options
author | Patrick Simianer <p@simianer.de> | 2016-07-05 11:30:02 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2016-07-05 11:30:02 +0200 |
commit | 43fcaa14840a18a4ab9e6ab9530933a6c60bd604 (patch) | |
tree | df00f5c8c08372645ef95a6137bfa8d924137f50 | |
parent | e34007450adcec8441b7a48613c0386defd58fad (diff) |
ruby/proc-in-out-in-out.rb
-rwxr-xr-x | ruby/proc-in-out-in-out.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ruby/proc-in-out-in-out.rb b/ruby/proc-in-out-in-out.rb new file mode 100755 index 0000000..645d620 --- /dev/null +++ b/ruby/proc-in-out-in-out.rb @@ -0,0 +1,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 + |