http://www.codeforpeople.com/lib/ruby/session/
2.1.6:
- wrapped send_command in a Thread (send async) so output processing can
commend immeadiately. this was o.k. before, but had strange behaviour when
using popen3 from threads. thanks to tanaka akira for this suggestion. - iff ENV[‘SESSION_USE_SPAWN’] is set Session uses Spawn::spawn instead of
Open3::popen3. also noted that spawn seems to be a bit faster. - added tests for threads.
- run ‘sh SESSION_USE_SPAWN=1 ruby test/session.rb’ to test using spawn
- added test for idl so it’s test is not run if system doesn’t have it, all
that should be required for ‘ruby test/session.rb’ is should be sh’ - removed sample/tcsh and note about Tcsh and Csh in README - stderr
redirection/separation is flaky in those shells
NAME: |
Session
::Sh
::Bash
::Shell
::IDL
SYNOPSIS: |
Session::* offers a set of class for driving external progams via pipes. It
offers a significant abstraction over Open3::popen since stdout/stderr can
be processed individually for each command. Additionally the exit_status of
each command is made available. eg.
bash = Session::Bash.new
stdout, stderr = bash.execute 'ls'
or
bash = Session::Bash.new
stdout, stderr = StringIO.new, StringIO.new
bash.execute 'ls', :stdout => stdout, :stderr => stderr
exit_status = bash.exit_status
or
bash = Session::Bash.new
# output is passed to the block as it is produced!
bash.execute( 'long_running_command.exe' ) do |out, err|
logger << out if out
elogger << err if err
end
SAMPLES: |
see samples/*
AUTHOR: |
-a
···
–
EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
URL :: Solar-Terrestrial Physics Data | NCEI
TRY :: for l in ruby perl;do $l -e “print "\x3a\x2d\x29\x0a"”;done
===============================================================================