summaryrefslogtreecommitdiff
path: root/lib/tempfile.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tempfile.rb')
-rw-r--r--lib/tempfile.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index 38a72e1..9333505 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -108,9 +108,13 @@ class Tempfile < DelegateClass(File)
# file.
def unlink
# keep this order for thread safeness
- File.unlink(@tmpname) if File.exist?(@tmpname)
- @@cleanlist.delete(@tmpname)
- @tmpname = nil
+ begin
+ File.unlink(@tmpname) if File.exist?(@tmpname)
+ @@cleanlist.delete(@tmpname)
+ @tmpname = nil
+ rescue Errno::EACCESS
+ # may not be able to unlink on Windows; just ignore
+ end
end
alias delete unlink