Commit 1745d4e8 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

provisioner/shell: close source script file handle

parent 3e8678f7
...@@ -165,6 +165,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error { ...@@ -165,6 +165,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
if err != nil { if err != nil {
return fmt.Errorf("Error opening shell script: %s", err) return fmt.Errorf("Error opening shell script: %s", err)
} }
defer f.Close()
log.Printf("Uploading %s => %s", path, p.config.RemotePath) log.Printf("Uploading %s => %s", path, p.config.RemotePath)
err = comm.Upload(p.config.RemotePath, f) err = comm.Upload(p.config.RemotePath, f)
...@@ -172,6 +173,9 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error { ...@@ -172,6 +173,9 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
return fmt.Errorf("Error uploading shell script: %s", err) return fmt.Errorf("Error uploading shell script: %s", err)
} }
// Close the original file since we copied it
f.Close()
// Flatten the environment variables // Flatten the environment variables
flattendVars := strings.Join(p.config.Vars, " ") flattendVars := strings.Join(p.config.Vars, " ")
......
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