Feature #1999 » tempfile-creation-error.diff
| 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
|
||