mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/ftools.rb (compare): don't return with a file opened
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e97d0b7764
commit
75c89b7eef
1 changed files with 2 additions and 2 deletions
|
@ -81,14 +81,14 @@ class << File
|
||||||
def compare from, to, verbose = false
|
def compare from, to, verbose = false
|
||||||
$stderr.print from, " <=> ", to, "\n" if verbose
|
$stderr.print from, " <=> ", to, "\n" if verbose
|
||||||
|
|
||||||
|
return false if stat(from).size != stat(to).size
|
||||||
|
|
||||||
from = open(from, "rb")
|
from = open(from, "rb")
|
||||||
to = open(to, "rb")
|
to = open(to, "rb")
|
||||||
|
|
||||||
ret = false
|
ret = false
|
||||||
fr = tr = ''
|
fr = tr = ''
|
||||||
|
|
||||||
return false if from.stat.size != to.stat.size
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
while fr == tr
|
while fr == tr
|
||||||
fr = from.read(BUFSIZE)
|
fr = from.read(BUFSIZE)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue