* 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:
parent
7bac09fc26
commit
ee647e1b96
@ -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>
|
Wed Sep 9 21:20:49 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ext/bigdecimal/bigdecimal.c (BigDecimal_data_type): typed.
|
* ext/bigdecimal/bigdecimal.c (BigDecimal_data_type): typed.
|
||||||
|
@ -1261,8 +1261,10 @@ module FileUtils
|
|||||||
end
|
end
|
||||||
|
|
||||||
def copy_file(dest)
|
def copy_file(dest)
|
||||||
File.open(dest, 'wb') do |f|
|
File.open(path()) do |s|
|
||||||
IO.copy_stream(path(), f)
|
File.open(dest, 'wb') do |f|
|
||||||
|
IO.copy_stream(s, f)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -223,6 +223,11 @@ end
|
|||||||
assert_same_entry srcpath, destpath
|
assert_same_entry srcpath, destpath
|
||||||
end
|
end
|
||||||
|
|
||||||
|
assert_raise(Errno::ENOENT) {
|
||||||
|
cp 'tmp/cptmp', 'tmp/cptmp_new'
|
||||||
|
}
|
||||||
|
assert_file_not_exist('tmp/cptmp_new')
|
||||||
|
|
||||||
# src==dest (1) same path
|
# src==dest (1) same path
|
||||||
touch 'tmp/cptmp'
|
touch 'tmp/cptmp'
|
||||||
assert_raise(ArgumentError) {
|
assert_raise(ArgumentError) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user