Project

General

Profile

Feature #1999 » tempfile-creation-error.diff

hongli (Hongli Lai), 08/29/2009 02:49 AM

View differences:

lib/tempfile.rb → Users/hongli/Projects/better/tempfile.rb
MAX_TRY = 10 # :nodoc:
@@cleanlist = []
@@lock = Mutex.new
class CreationError < StandardError # :nodoc:
end
# call-seq:
# new(basename, [tmpdir = Dir.tmpdir], [options])
......
rescue
failure += 1
retry if failure < MAX_TRY
raise "cannot generate tempfile `#{tmpname}'"
raise CreationError, "cannot generate tempfile `#{tmpname}'"
end
}
......
def callback(data) # :nodoc:
pid = $$
Proc.new {
if pid == $$
path, tmpfile, cleanlist = *data
    (1-1/1)