From: "Ara.T.Howard" Date: 2004-03-26T01:34:40+09:00 Subject: [ANN] session-2.1.5 http://www.codeforpeople.com/lib/ruby/session/ 2.1.5: - added Session.use_spawn=, AbstractSession.use_spawn=, and an :use_session=> option to AbstractSession#initialize. if any of them are set the code uses Spawn::spawn to create external processes instead of Open3::popen3. Spawn::spawn uses named pipes (fifos) for IPC instead of forking and pipes. the fork used in popen3 can cause strange behaviour with multi-threaded apps (like a tk app). see source for details NAME Session ::Sh ::Bash ::Csh ::Tcsh ::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 ara.t.howard@noaa.gov -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 :: http://www.ngdc.noaa.gov/stp/ | TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done ===============================================================================