From: ahoward Date: 2002-11-10T01:40:47+09:00 Subject: Re: help - redirect/flush/sync problem On Sat, 9 Nov 2002, ts wrote: > This raises an exception and you don't catch it. Consequence the error > message is printed in 'stderr' when ruby exit (i.e. it don't execute the > lines after the error) nope. #!/usr/bin/env ruby begin $stderr.reopen File.open 'stderr', 'w' $stderr.sync = true foo # this raises an exception... ensure $stderr.flush puts IO.readlines 'stderr', 'r' puts __FILE__ end this outputs only 'foo.rb' eli > ruby foo.rb foo.rb eli > cat stderr foo.rb:9: undefined local variable or method `foo' for # (NameError) so the file IS created... this is *really* bizare.... is it a bug in ruby? here is another hint : if i also do $stderr.close after $stderr.flush, the file is not even created! -a -- ==================================== | Ara Howard | NOAA Forecast Systems Laboratory | Information and Technology Services | Data Systems Group | R/FST 325 Broadway | Boulder, CO 80305-3328 | Email: ahoward@fsl.noaa.gov | Phone: 303-497-7238 | Fax: 303-497-7259 ====================================