ruby-changes:46679
From: nobu <ko1@a...>
Date: Fri, 19 May 2017 18:36:39 +0900 (JST)
Subject: [ruby-changes:46679] nobu:r58794 (trunk): tempfile.rb: do not call File.identical? on closed stream
nobu 2017-05-19 18:36:34 +0900 (Fri, 19 May 2017) New Revision: 58794 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58794 Log: tempfile.rb: do not call File.identical? on closed stream Modified files: trunk/lib/tempfile.rb Index: lib/tempfile.rb =================================================================== --- lib/tempfile.rb (revision 58793) +++ lib/tempfile.rb (revision 58794) @@ -334,10 +334,12 @@ def Tempfile.create(basename="", tmpdir= https://github.com/ruby/ruby/blob/trunk/lib/tempfile.rb#L334 begin yield tmpfile ensure - if File.identical?(tmpfile, tmpfile.path) - unlinked = File.unlink tmpfile.path rescue nil + unless tmpfile.closed? + if File.identical?(tmpfile, tmpfile.path) + unlinked = File.unlink tmpfile.path rescue nil + end + tmpfile.close end - tmpfile.close unless unlinked begin File.unlink tmpfile.path -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/