Commit 29f02d24 authored by Chris Bednarski's avatar Chris Bednarski

Had io.Copy args swapped; also use os.Create instead of os.OpenFile for MAGIC

parent 9c5845e3
......@@ -57,14 +57,15 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
return nil, err
}
target, err := os.OpenFile(b.config.Target, os.O_WRONLY, 0600)
// Create will truncate an existing file
target, err := os.Create(b.config.Target)
defer target.Close()
if err != nil {
return nil, err
}
ui.Say(fmt.Sprintf("Copying %s to %s", source.Name(), target.Name()))
bytes, err := io.Copy(source, target)
bytes, err := io.Copy(target, source)
if err != nil {
return nil, err
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment