From: ara.t.howard@... Date: 2006-07-02T04:29:49+09:00 Subject: Re: How to open a console and ruby a ruby script from ruby? On Sun, 2 Jul 2006 transfire@gmail.com wrote: > > ara.t.how...@noaa.gov wrote: >> On Sun, 2 Jul 2006 transfire@gmail.com wrote: >> >>> I know I can do >>> >>> system "ruby script.rb" >>> >>> But I want to open a console to run it in. >> >> you mean a pty? check out ext/pty, there's an example in there. > > I want a window to come up with a shell propmt (or dos on windows). you probably want something like fortytwo :~ > cat a.rb require 'rbconfig' require 'tempfile' def console command arch = Config::CONFIG['arch'] unless arch =~ %r/win/i tmp = Tempfile.new Process.pid.to_s tmp << command tmp << "\n" tmp << "bash" tmp << "\n" tmp.close begin system "xterm -e 'bash -l -i #{ tmp.path }'" ensure tmp.close! end else raise 'windoze' end end console 'date' i'll leave the windoze bit to you ;-) regards. -a -- suffering increases your inner strength. also, the wishing for suffering makes the suffering disappear. - h.h. the 14th dali lama