This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new ba592c2  Simplify using block
ba592c2 is described below

commit ba592c2a6baef65fce3274c754c950f7c0b1517a
Author: Sebb <[email protected]>
AuthorDate: Tue Sep 22 17:07:56 2020 +0100

    Simplify using block
---
 lib/whimsy/asf/svn.rb | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index 621d01f..dbc6c35 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -604,10 +604,10 @@ module ASF
         dir.untaint
         basename.untaint
       end
-      
-      tmpdir = Dir.mktmpdir.untaint
 
-      begin
+      rc = 0
+      Dir.mktmpdir do |tmpdir|
+
         # create an empty checkout
         self.svn_('checkout', [self.getInfoItem(dir,'url'), tmpdir], _,
           {depth: 'empty', env: env})
@@ -635,7 +635,7 @@ module ASF
           contents = yield tmpdir, ''
           previous_contents = File.read(tmpfile) if File.file? tmpfile
         end
-     
+
         # create/update the temporary copy
         if contents and not contents.empty?
           File.write tmpfile, contents
@@ -664,8 +664,7 @@ module ASF
         unless rc == 0 && out && out.empty?
           raise "svn failure #{rc} #{path.inspect} #{out}"
         end
-      ensure
-        FileUtils.rm_rf tmpdir
+
       end
       rc # return last status
     end

Reply via email to