aboutsummaryrefslogtreecommitdiffstats
path: root/lib/fileutils.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-11 07:51:19 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-11 07:51:19 +0000
commitc2eac0e78c35fc7c23c4ec7024d7555b31d7bae6 (patch)
tree012c0d702f74de9dc5f487be06c7421b0c719c6b /lib/fileutils.rb
parent94bbd10ea71120d7f21e1025d1f1a3b804db770e (diff)
downloadruby-c2eac0e78c35fc7c23c4ec7024d7555b31d7bae6.tar.gz
* lib/fileutils.rb: handle ENOENT error with symlink targeted to
non-exists file. [ruby-dev:45933] [Bug #6716] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/fileutils.rb')
-rw-r--r--lib/fileutils.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/fileutils.rb b/lib/fileutils.rb
index 050180b940..7113386c73 100644
--- a/lib/fileutils.rb
+++ b/lib/fileutils.rb
@@ -856,7 +856,8 @@ module FileUtils
fu_check_options options, OPT_TABLE['install']
fu_output_message "install -c#{options[:preserve] && ' -p'}#{options[:mode] ? (' -m 0%o' % options[:mode]) : ''} #{[src,dest].flatten.join ' '}" if options[:verbose]
return if options[:noop]
- fu_each_src_dest(src, dest) do |s, d, st|
+ fu_each_src_dest(src, dest) do |s, d|
+ st = File.stat(s)
unless File.exist?(d) and compare_file(s, d)
remove_file d, true
copy_file s, d
@@ -1242,7 +1243,12 @@ module FileUtils
end
def exist?
- lstat! ? true : false
+ begin
+ lstat
+ true
+ rescue Errno::ENOENT
+ false
+ end
end
def file?
@@ -1560,7 +1566,7 @@ module FileUtils
def fu_each_src_dest(src, dest) #:nodoc:
fu_each_src_dest0(src, dest) do |s, d|
raise ArgumentError, "same file: #{s} and #{d}" if fu_same?(s, d)
- yield s, d, File.stat(s)
+ yield s, d
end
end
private_module_function :fu_each_src_dest