Skip to content

Instantly share code, notes, and snippets.

@toretore
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save toretore/393c9b9761c74bf1d7da to your computer and use it in GitHub Desktop.

Select an option

Save toretore/393c9b9761c74bf1d7da to your computer and use it in GitHub Desktop.
require 'open3'
Open3.popen3 'bash' do |stdin, stdout, stderr, wait|
t=Thread.new{ stdout.each{|l| print l } }
stdin.puts 'ls'
stdin.puts 'exit'
wait.join
t.join
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment