summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-09 13:02:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-09 13:02:04 +0000
commitcafcbf60497bfb548bc1f11491e107d5c224fd9e (patch)
treebad802710564ca06fda70804ed941e92fdb3ba71 /lib
parentb7a20fdf6100ff6e857b81ec9e076c6102893cc3 (diff)
downloadruby-cafcbf60497bfb548bc1f11491e107d5c224fd9e.tar.gz
ruby-cafcbf60497bfb548bc1f11491e107d5c224fd9e.tar.xz
ruby-cafcbf60497bfb548bc1f11491e107d5c224fd9e.zip
* lib/fileutils.rb (FileUtils::Entry_#copy_file): open the source
file first to ensure it can be copied. [ruby-core:25498] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/fileutils.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/fileutils.rb b/lib/fileutils.rb
index 2a6b24858..58e3f1d68 100644
--- a/lib/fileutils.rb
+++ b/lib/fileutils.rb
@@ -1261,8 +1261,10 @@ module FileUtils
end
def copy_file(dest)
- File.open(dest, 'wb') do |f|
- IO.copy_stream(path(), f)
+ File.open(path()) do |s|
+ File.open(dest, 'wb') do |f|
+ IO.copy_stream(s, f)
+ end
end
end