lib/veewee/provider/core/helper/iso.rb in veewee-0.3.0.alpha5 vs lib/veewee/provider/core/helper/iso.rb in veewee-0.3.0.alpha6
- old
+ new
@@ -38,10 +38,13 @@
pbar.set s if pbar
}) { |src|
# We assume large 10K files, so this is tempfile object
env.logger.info "#{src.class}"
env.ui.info "Moving #{src.path} to #{localfile}"
+ # Force the close of the src stream to release handle before moving
+ # Not forcing the close may cause an issue on windows (Permission Denied)
+ src.close
FileUtils.mv(src.path,localfile)
#open(localfile,"wb") { |dst|
#dst.write(src.read)
#}
}
@@ -49,10 +52,10 @@
# Compute hash code
def hashsum(filename)
checksum=Digest::MD5.new
buflen=1024
- open(filename, "r") do |io|
+ open(filename, "rb") do |io|
counter = 0
while (!io.eof)
readBuf = io.readpartial(buflen)
env.ui.info('.',{:new_line => false}) if ((counter+=1) % 20000 == 0)
checksum.update(readBuf)