summaryrefslogtreecommitdiff
path: root/ruby
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2016-07-05 11:30:02 +0200
committerPatrick Simianer <p@simianer.de>2016-07-05 11:30:02 +0200
commit43fcaa14840a18a4ab9e6ab9530933a6c60bd604 (patch)
treedf00f5c8c08372645ef95a6137bfa8d924137f50 /ruby
parente34007450adcec8441b7a48613c0386defd58fad (diff)
ruby/proc-in-out-in-out.rb
Diffstat (limited to 'ruby')
-rwxr-xr-xruby/proc-in-out-in-out.rb17
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
+