1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/tempfile.rb (Tempfile::_close): should not clear @tmpname

until the file is really removed. [ruby-core:02684]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2004-03-24 01:08:20 +00:00
parent 9de96e572c
commit a43eeaef75
2 changed files with 12 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Wed Mar 24 10:05:22 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/tempfile.rb (Tempfile::_close): should not clear @tmpname
until the file is really removed. [ruby-core:02684]
Wed Mar 24 04:12:44 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* object.c (rb_mod_cvar_get): new method Module#class_variable_get.

View file

@ -76,12 +76,13 @@ class Tempfile < SimpleDelegator
def _close # :nodoc:
@tmpfile.close if @tmpfile
@data[1] = @tmpfile = nil
@data = @tmpname = nil
@tmpfile = nil
@data[1] = nil if @data
@data = nil
end
protected :_close
# Closes the file. If the optional flag is true, unlinks the file
#Closes the file. If the optional flag is true, unlinks the file
# after closing.
#
# If you don't explicitly unlink the temporary file, the removal
@ -99,6 +100,7 @@ class Tempfile < SimpleDelegator
_close
@clean_proc.call
ObjectSpace.undefine_finalizer(self)
@tmpname = nil
end
# Unlinks the file. On UNIX-like systems, it is often a good idea
@ -108,7 +110,8 @@ class Tempfile < SimpleDelegator
def unlink
# keep this order for thread safeness
File.unlink(@tmpname) if File.exist?(@tmpname)
@@cleanlist.delete(@tmpname) if @@cleanlist
@@cleanlist.delete(@tmpname)
@tmpname = nil
end
alias delete unlink