From: "David E." Date: 2010-11-30T05:24:06+09:00 Subject: Re: when using system(), how do I redirect Exception msgs? David E. wrote in post #964857: > So from my console, I execute the Ruby script via: > > ruby TestSuite.rb > /Users/dave/Desktop/outputtext.xml > > Within my script I have several > --- > begin > system('ruby /Users/dave/Desktop/testruby.rb'); > system('ruby /Users/dave/Desktop/testruby2.rb'); > system('ruby /Users/dave/Desktop/testruby3.rb'); > rescue Exception=>msg > puts("Hi there exception") > puts(msg) > end > --- > > calls... > > To test it, I put in testruby4.rb, but no file called testruby4.rb > exists. > > I get a LoadError Exception as expected, and in my script I see the > trace on the console, but not via the puts() commands... > > How come the script is ignoring the rescue clause I have here and how > can I get it to not ignore it? > > THanks! I answered/found my own question. Instead of system(), I use load(). This seems to run the script within the "Calling script" context. I'll figure out more exactly why, but it seems as if load() works. -- Posted via http://www.ruby-forum.com/.