diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-24 01:08:20 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-24 01:08:20 +0000 |
| commit | 7b47124ca1a292c9d072315c5f8fe213ae0c9637 (patch) | |
| tree | 2bba107c67c141fd2b31aa01e38f43821df2fc04 /lib | |
| parent | da088eb50aabf77afd2dbf514d5a3152804689e0 (diff) | |
| download | ruby-7b47124ca1a292c9d072315c5f8fe213ae0c9637.tar.gz ruby-7b47124ca1a292c9d072315c5f8fe213ae0c9637.tar.xz ruby-7b47124ca1a292c9d072315c5f8fe213ae0c9637.zip | |
* lib/tempfile.rb (Tempfile::_close): should not clear @tmpname
until the file is really removed. [ruby-core:02684]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@6007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/tempfile.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/tempfile.rb b/lib/tempfile.rb index 2169a20ec..8ebabc9ea 100644 --- a/lib/tempfile.rb +++ b/lib/tempfile.rb @@ -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 |
