From: "Mark L." Date: 2011-01-25T20:44:28+09:00 Subject: Re: FileUtils writing to stderr Hi Eric, I see your point. I should be able to check the return code for errors. This would make the ant task even simpler as I would just have to set the 'failonerror' flag. I guess my question above was trying to find another way of doing this because initially the return code was returning 0 when I was not expecting it. After reading your comments I've gone back to look at the code to see if I could pinpoint where it was going wrong (you'll have to forgive me - I'm new to ruby and am modifying a script written by someone else) I traced the problem to a 'system' command. We are using a javascript closure compiler to minify some javascript. It would fail if there was a syntax error in the javascript - but the rake script would exit normally. The original piece of code looked like: system `#{JAVA_CMD} -jar #{JS_ROOT}/lib/compiler.jar --js=#{src} --js_output_file=#{dst}` and then the rake script carried on as normal. I then tried to capture the $? of the command and raise an exception if it was non-zero. Unfortunately, as it stands the above command always returns a non-zero response. I eventually figured out that it was the back-ticks that was causing the issue and so my final solution was to do this: system("#{JAVA_CMD} -jar #{JS_ROOT}/lib/compiler.jar --js=#{src} --js_output_file=#{dst}") # Raise an exception if the compiler fails if( !$?.success? ) raise "Closure Compiler failed to compile javascript" end and this finally seemed to resolve my problem. Thanks for the response, Mark. -- Posted via http://www.ruby-forum.com/.