[前][次][番号順一覧][スレッド一覧]

ruby-changes:62751

From: Benoit <ko1@a...>
Date: Sat, 29 Aug 2020 19:30:59 +0900 (JST)
Subject: [ruby-changes:62751] fa21985a7a (master): Sync with ruby/tempfile@aa9ea12d94a905161cbd79af1ad9ab427f250f4e

https://git.ruby-lang.org/ruby.git/commit/?id=fa21985a7a

From fa21985a7a2f8f52a8bd82bd12a724e9dca74934 Mon Sep 17 00:00:00 2001
From: Benoit Daloze <eregontp@g...>
Date: Sat, 29 Aug 2020 11:53:05 +0200
Subject: Sync with ruby/tempfile@aa9ea12d94a905161cbd79af1ad9ab427f250f4e


diff --git a/NEWS.md b/NEWS.md
index d166046..1355d92 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -191,6 +191,16 @@ Outstanding ones only. https://github.com/ruby/ruby/blob/trunk/NEWS.md#L191
           take request headers as a Hash in the second argument when the first
           argument is a URI.  [[Feature #16686]]
 
+* Tempfile
+
+    * Modified method
+
+        * `Tempfile.open { ... }` will now unlink the file at the end of the
+          block (https://github.com/ruby/tempfile/pull/3), such that once the
+          block finishes execution nothing leaks.
+
+
+
 ## Compatibility issues
 
 Excluding feature bug fixes.
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index efb0b1b..4148d30 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -290,7 +290,7 @@ class Tempfile < DelegateClass(File) https://github.com/ruby/ruby/blob/trunk/lib/tempfile.rb#L290
         begin
           yield(tempfile)
         ensure
-          tempfile.close
+          tempfile.close!
         end
       else
         tempfile
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]