aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-10-28 13:22:45 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-10-28 13:22:45 -0700
commit5bbe245a51cec029101c844e159ba7f7a7afedab (patch)
tree9fd823b4d3a8be8989a5e69b9e08d64170ee300b
parenta273b6bd34fe5361b121e450f69d95277166c049 (diff)
parent8d0efcc5757a486084c73054202702a2028cba77 (diff)
downloadrails-5bbe245a51cec029101c844e159ba7f7a7afedab.tar.gz
rails-5bbe245a51cec029101c844e159ba7f7a7afedab.tar.bz2
rails-5bbe245a51cec029101c844e159ba7f7a7afedab.zip
Merge pull request #8046 from pmahoney/exceptions_as_flow_control
Replace flow-control exception with explicit test.
-rw-r--r--activesupport/lib/active_support/core_ext/file/atomic.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/file/atomic.rb b/activesupport/lib/active_support/core_ext/file/atomic.rb
index 81beb4e85d..38ea7f8fb3 100644
--- a/activesupport/lib/active_support/core_ext/file/atomic.rb
+++ b/activesupport/lib/active_support/core_ext/file/atomic.rb
@@ -23,10 +23,10 @@ class File
yield temp_file
temp_file.close
- begin
+ if File.exists?(file_name)
# Get original file permissions
old_stat = stat(file_name)
- rescue Errno::ENOENT
+ else
# If not possible, probe which are the default permissions in the
# destination directory.
old_stat = probe_stat_in(dirname(file_name))