Sha256: 0aee9cc524ce6f6a48ed1c5f7d491baba74a70e1d3b0359a5f2186895adb075f

Contents?: true

Size: 1.25 KB

Versions: 23

Compression:

Stored size: 1.25 KB

Contents

#!/usr/bin/env ruby
$:.unshift '.', '..', 'lib', File.join('..','lib')

require 'session'


bash = Session::Bash.new


puts "======== ======== ======== ========"
puts "#1"
puts "======== ======== ======== ========"

stdout, stderr = bash.execute 'ls'

puts "STDOUT:\n#{ stdout }"
puts "STDERR:\n#{ stderr }"

puts "STATUS: #{ bash.status }"
puts "======== ======== ======== ========"


puts "======== ======== ======== ========"
puts "#2"
puts "======== ======== ======== ========"

bash.execute 'ls' do |stdout, stderr|
  puts "STDOUT:\n#{ stdout }"
  puts "STDERR:\n#{ stderr }"
end

puts "STATUS: #{ bash.status }"
puts "======== ======== ======== ========"


puts "======== ======== ======== ========"
puts "#3"
puts "======== ======== ======== ========"

stdout, stderr = '', ''
bash.execute 'ls', :stdout => stdout, :stderr => stderr

puts "STDOUT:\n#{ stdout }"
puts "STDERR:\n#{ stderr }"

puts "STATUS: #{ bash.status }"
puts "======== ======== ======== ========"


puts "======== ======== ======== ========"
puts "#4"
puts "======== ======== ======== ========"

bash.outproc = lambda{|out| puts "#{ out }"}
bash.errproc = lambda{|err| raise err}

bash.execute('while test 1; do echo 42; sleep 1; done') # => 42 ... 42 ... 42 
puts "======== ======== ======== ========"


Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
session-3.2.0 sample/bash.rb
session-3.1.2 sample/bash.rb
session-3.1.1 sample/bash.rb
redcar-0.5.1 plugins/runnables/vendor/session/sample/bash.rb
redcar-0.5 plugins/runnables/vendor/session/sample/bash.rb
redcar-0.5.6dev plugins/runnables/vendor/session/sample/bash.rb
redcar-0.5.5dev plugins/runnables/vendor/session/sample/bash.rb
redcar-0.5.4dev plugins/runnables/vendor/session/sample/bash.rb
redcar-0.5.3dev plugins/runnables/vendor/session/sample/bash.rb
redcar-0.5.2dev plugins/runnables/vendor/session/sample/bash.rb
redcar-0.5.1dev plugins/runnables/vendor/session/sample/bash.rb
redcar-0.4.1 plugins/runnables/vendor/session/sample/bash.rb
redcar-0.4 plugins/runnables/vendor/session/sample/bash.rb
redcar-0.3.10.1dev plugins/runnables/vendor/session/sample/bash.rb
redcar-0.3.10.0dev plugins/runnables/vendor/session/sample/bash.rb
redcar-0.3.9 plugins/runnables/vendor/session-2.4.0/sample/bash.rb
redcar-0.3.9.0dev plugins/runnables/vendor/session-2.4.0/sample/bash.rb
redcar-0.3.8.4 plugins/runnables/vendor/session-2.4.0/sample/bash.rb
redcar-0.3.8.3 plugins/runnables/vendor/session-2.4.0/sample/bash.rb
redcar-0.3.8.2 plugins/runnables/vendor/session-2.4.0/sample/bash.rb