mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-22 16:01:43 -04:00
provisioner/shell: close source script file handle
This commit is contained in:
@@ -165,6 +165,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error opening shell script: %s", err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
log.Printf("Uploading %s => %s", path, p.config.RemotePath)
|
||||
err = comm.Upload(p.config.RemotePath, f)
|
||||
@@ -172,6 +173,9 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
|
||||
return fmt.Errorf("Error uploading shell script: %s", err)
|
||||
}
|
||||
|
||||
// Close the original file since we copied it
|
||||
f.Close()
|
||||
|
||||
// Flatten the environment variables
|
||||
flattendVars := strings.Join(p.config.Vars, " ")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user