Had io.Copy args swapped; also use os.Create instead of os.OpenFile for MAGIC
This commit is contained in:
parent
9c5845e3c7
commit
29f02d243f
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue