URLS: | http://raa.ruby-lang.org/project/session/ http://www.codeforpeople.com/lib/ruby/session/ 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 Sessions are Thread safe (in the sense that they do not block on io operations) allowing command spawn from guis to update widgets with output while running in the background. button.configure 'action' => lambda do sh = Session::new sh.execute(cmd) do |o,e| out_widget.update o if o err_widget.update e if e end end SAMPLES: | see samples/* AUTHOR: | ara.t.howard@noaa.gov