* 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:
parent
9de96e572c
commit
a43eeaef75
@ -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>
|
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.
|
* object.c (rb_mod_cvar_get): new method Module#class_variable_get.
|
||||||
|
@ -76,8 +76,9 @@ class Tempfile < SimpleDelegator
|
|||||||
|
|
||||||
def _close # :nodoc:
|
def _close # :nodoc:
|
||||||
@tmpfile.close if @tmpfile
|
@tmpfile.close if @tmpfile
|
||||||
@data[1] = @tmpfile = nil
|
@tmpfile = nil
|
||||||
@data = @tmpname = nil
|
@data[1] = nil if @data
|
||||||
|
@data = nil
|
||||||
end
|
end
|
||||||
protected :_close
|
protected :_close
|
||||||
|
|
||||||
@ -99,6 +100,7 @@ class Tempfile < SimpleDelegator
|
|||||||
_close
|
_close
|
||||||
@clean_proc.call
|
@clean_proc.call
|
||||||
ObjectSpace.undefine_finalizer(self)
|
ObjectSpace.undefine_finalizer(self)
|
||||||
|
@tmpname = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# Unlinks the file. On UNIX-like systems, it is often a good idea
|
# Unlinks the file. On UNIX-like systems, it is often a good idea
|
||||||
@ -108,7 +110,8 @@ class Tempfile < SimpleDelegator
|
|||||||
def unlink
|
def unlink
|
||||||
# keep this order for thread safeness
|
# keep this order for thread safeness
|
||||||
File.unlink(@tmpname) if File.exist?(@tmpname)
|
File.unlink(@tmpname) if File.exist?(@tmpname)
|
||||||
@@cleanlist.delete(@tmpname) if @@cleanlist
|
@@cleanlist.delete(@tmpname)
|
||||||
|
@tmpname = nil
|
||||||
end
|
end
|
||||||
alias delete unlink
|
alias delete unlink
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user