Close and unlink iso tempfile
On Windows tempfile.delete does not delete the file. It needs to be closed and unlinked
This commit is contained in:
parent
5caae15f22
commit
476977a732
@ -30,7 +30,8 @@ module Vagrant
|
||||
if file_destination.nil?
|
||||
tmpfile = Tempfile.new(["vagrant", ".iso"])
|
||||
file_destination = Pathname.new(tmpfile.path)
|
||||
tmpfile.delete
|
||||
tmpfile.close
|
||||
tmpfile.unlink
|
||||
else
|
||||
file_destination = Pathname.new(file_destination.to_s)
|
||||
# If the file destination path is a folder, target the output to a randomly named
|
||||
|
||||
@ -62,7 +62,8 @@ describe VagrantPlugins::HostDarwin::Cap::FsISO do
|
||||
).and_return(double(exit_code: 0))
|
||||
# Should create a directory wherever Tempfile creates files by default
|
||||
expect(FileUtils).to receive(:mkdir_p).with(Pathname.new(file_destination).dirname)
|
||||
|
||||
allow(file_destination).to receive(:close)
|
||||
allow(file_destination).to receive(:unlink)
|
||||
output = subject.create_iso(env, "/foo/src")
|
||||
expect(output.to_s).to eq(file_destination)
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user