From af1187d5e176914cd1b2b14de2449d295c3b53e2 Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Fri, 15 Sep 2017 10:06:54 -0700 Subject: [PATCH] simplify a bit --- provisioner/powershell/provisioner.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/provisioner/powershell/provisioner.go b/provisioner/powershell/provisioner.go index d11136f3d..e9adbc6df 100644 --- a/provisioner/powershell/provisioner.go +++ b/provisioner/powershell/provisioner.go @@ -469,12 +469,10 @@ func (p *Provisioner) generateElevatedRunner(command string) (uploadedPath strin fmt.Printf("Error creating elevated template: %s", err) return "", err } - wrapperBytes := buffer.Bytes() - wrapperReader := bytes.NewReader(wrapperBytes) uuid := uuid.TimeOrderedUUID() path := fmt.Sprintf(`${env:TEMP}\packer-elevated-shell-%s.ps1`, uuid) log.Printf("Uploading elevated shell wrapper for command [%s] to [%s]", command, path) - err = p.communicator.Upload(path, wrapperReader, nil) + err = p.communicator.Upload(path, &buffer, nil) if err != nil { return "", fmt.Errorf("Error preparing elevated powershell script: %s", err) }