Net/FTP: failed download creates empty file


#1

I’m downloading a file via FTP like this:

require ‘net/ftp’
ftp=Net::FTP.new(hostname,userid,password)
begin
ftp.getbinaryfile(‘fluffi’)
rescue Net::FTPPermError
puts “download #{filename} failed (#{$!.to_s.chomp})”
end

This works basically fine, with one minor glitch: If the file (‘fluffi’)
does not
exist (i.e. the exception is thrown - “download fluffi failed (550 Can’t
open
fluffi: No such file or directory)”), there is still a file ‘fluffi’
created
with length 0.

Is this a bug or intended behaviour?

Ronald