You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2019/11/27 13:02:45 UTC
[whimsy] branch master updated: Use temp file and rename rather
than direct write
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 a71123d Use temp file and rename rather than direct write
a71123d is described below
commit a71123d8955a71664284fe33e945232ff63dbb67
Author: Sebb <se...@apache.org>
AuthorDate: Wed Nov 27 13:02:08 2019 +0000
Use temp file and rename rather than direct write
---
lib/whimsy/asf/svn.rb | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index e4dd86f..27c7ffa 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -428,6 +428,7 @@ module ASF
return nil,"Cannot find URL"
end
listfile = File.join(ASF::Config.root,'svn',"%s.txt" % name)
+ listfiletmp = File.join(ASF::Config.root,'svn',"%s.tmp" % name)
filerev = "0"
svnrev = "?"
begin
@@ -441,10 +442,11 @@ module ASF
begin
unless filerev == svnrev
list = self.list(url, user, password)
- open(listfile,'w') do |w|
+ open(listfiletmp,'w') do |w|
w.puts svnrev
w.puts list
- end
+ end
+ File.rename(listfiletmp,listfile)
end
rescue Exception => e
return nil,e.inspect