From: "dafiku (dafi harisy)" Date: 2012-10-23T14:31:10+09:00 Subject: [ruby-core:48162] [ruby-trunk - Bug #1494] tempfile#unlink may silently fail on windows Issue #1494 has been updated by dafiku (dafi harisy). Everlastingly, an issue with the intention of I am passionate in this vicinity. I be inflicted with looked for in rank of this feature for the last numerous hours. Your locate is greatly valued. http://www.yourhousecontents.com/ http://www.electroscanogram.com/ http://www.videophototravel.info/ http://www.supershinelaundry.com/ http://www.ywor.info/ http://www.bicity.info/ http://www.ubidyne.info/ ---------------------------------------- Bug #1494: tempfile#unlink may silently fail on windows https://bugs.ruby-lang.org/issues/1494#change-31320 Author: modethree3 (Nicholas Manning) Status: Third Party's Issue Priority: High Assignee: Category: lib Target version: 1.9.1 ruby -v: ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] =begin There is an unlink method that was causing an exception when running it on my windows machine. The method will call the 'rescue' block but then will do nothing. This is problematic when things like RubyInline uses this method to create temp files and then delete them on windows. Suggested patch (from http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/2848) (thanks to Florian Frank who wrote it). --- lib/tempfile.rb 23 Jul 2003 16:37:35 -0000 1.19 +++ lib/tempfile.rb 5 May 2004 23:33:57 -0000 @@ -106,7 +106,10 @@ class Tempfile < SimpleDelegator # file. def unlink # keep this order for thread safeness - File.unlink(@tmpname) if File.exist?(@tmpname) + if File.exist?(@tmpname) + closed? or close + File.unlink(@tmpname) + end @@cleanlist.delete(@tmpname) if @@cleanlist end alias delete unlink =end -- http://bugs.ruby-lang.org/