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
82 82
  MAX_TRY = 10  # :nodoc:
83 83
  @@cleanlist = []
84 84
  @@lock = Mutex.new
85
  
86
  class CreationError < StandardError # :nodoc:
87
  end
85 88

  
86 89
  # call-seq:
87 90
  #    new(basename, [tmpdir = Dir.tmpdir], [options])
......
155 158
      rescue
156 159
        failure += 1
157 160
        retry if failure < MAX_TRY
158
        raise "cannot generate tempfile `#{tmpname}'"
161
        raise CreationError, "cannot generate tempfile `#{tmpname}'"
159 162
      end
160 163
    }
161 164

  
......
304 307
    def callback(data)	# :nodoc:
305 308
      pid = $$
306 309
      Proc.new {
310

  
307 311
	if pid == $$
308 312
	  path, tmpfile, cleanlist = *data
309 313