From: Andrew Timberlake Date: 2009-02-15T02:09:19+09:00 Subject: Re: Error handling in Ruby scripts --001636499f6d4fd2120462e409e5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, Feb 13, 2009 at 2:30 PM, Peter Bailey wrote: > snex wrote: > > On Feb 12, 1:38=EF=BF=BDpm, Peter Bailey wrote: > >> input file that's just bad. So, my Alchemy Ruby code fails, because > >> class Alchemy > >> =EF=BF=BD =EF=BF=BD `alchemy #{file} -t1 -Zc1 -Zm2 -b -c256 -8 -Za4 -Z= d 300 300 .300 -o` > >> =EF=BF=BD end > >> end > >> -- > >> Posted viahttp://www.ruby-forum.com/. > > > > its not going to work the way you are doing it. backquotes cant tell > > if the command inside them completed "successfully" or not, they just > > run it and return STDOUT. you need to analyze the return status of the > > command, then raise an error if it failed. > > OK. Thanks. Well, obviously, I've got to use backquotes or "system" in > this case. Being a Windows command shell program, a successful result > would be "0" in Windows, "1" or anything else if unsuccessful. Can I > capture that as part of my "raise?" > -- > Posted via http://www.ruby-forum.com/. > > You can get the exit status from $?.exitstatus Andrew Timberlake http://ramblingsonrails.com http://www.linkedin.com/in/andrewtimberlake "I have never let my schooling interfere with my education" - Mark Twain --001636499f6d4fd2120462e409e5--