From b9ab2c8048d766a6bb4d13f285f8e699304dad6c Mon Sep 17 00:00:00 2001 From: DanHam Date: Thu, 26 Apr 2018 00:17:13 +0100 Subject: [PATCH] Remove script containing PowerShell inline commands from local tmp when done --- provisioner/powershell/provisioner.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/provisioner/powershell/provisioner.go b/provisioner/powershell/provisioner.go index 82ec98c82..6eb9c5572 100644 --- a/provisioner/powershell/provisioner.go +++ b/provisioner/powershell/provisioner.go @@ -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 {