From: "Ara.T.Howard" Date: 2004-03-26T02:44:29+09:00 Subject: Re: [ANN] session-2.1.5 On Fri, 26 Mar 2004, Richard Kilmer wrote: > This totally kicks butt! thanks. it's been really useful thus far. > Would you consider making a RubyForge project out of it? sure. i've just got too much going on at the moment to breath... any advice on the subject? > I am definitely going to use this here at DARPA. cool. feel free to contact me directly with any comments, especially those containing patches! ;-) cheers. -a > > best, > > Rich > On Mar 25, 2004, at 11:34 AM, Ara.T.Howard wrote: > > > > > > > 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 > > ======================================================================= > > ======== > > > > > > > > > > -- =============================================================================== | 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 ===============================================================================