1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/fileutils.rb (FileUtils::Entry_#copy_file): open the source

file first to ensure it can be copied.  [ruby-core:25498]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-09-09 13:02:04 +00:00
parent 7bac09fc26
commit ee647e1b96
3 changed files with 14 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Wed Sep 9 22:02:02 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/fileutils.rb (FileUtils::Entry_#copy_file): open the source
file first to ensure it can be copied. [ruby-core:25498]
Wed Sep 9 21:20:49 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/bigdecimal/bigdecimal.c (BigDecimal_data_type): typed.

View file

@ -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

View file

@ -223,6 +223,11 @@ end
assert_same_entry srcpath, destpath
end
assert_raise(Errno::ENOENT) {
cp 'tmp/cptmp', 'tmp/cptmp_new'
}
assert_file_not_exist('tmp/cptmp_new')
# src==dest (1) same path
touch 'tmp/cptmp'
assert_raise(ArgumentError) {