Merge pull request #6199 from DanHam/ps-and-win-sh-cleanup-tmp

Clean up temp files created for PowerShell and Windows-Shell inline provisioner's
This commit is contained in:
M. Marsh 2018-04-26 10:54:00 -07:00 committed by GitHub
commit 2650d59499
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -269,6 +269,8 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
ui.Error(fmt.Sprintf("Unable to extract inline scripts into a file: %s", err))
}
scripts = append(scripts, temp)
// Remove temp script containing the inline commands when done
defer os.Remove(temp)
}
for _, path := range scripts {

View File

@ -190,6 +190,8 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
ui.Error(fmt.Sprintf("Unable to extract inline scripts into a file: %s", err))
}
scripts = append(scripts, temp)
// Remove temp script containing the inline commands when done
defer os.Remove(temp)
}
for _, path := range scripts {