From 19c997cb0e3eb7059c1fd8a68185d54826422e57 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Wed, 6 Dec 2017 10:37:11 -0800 Subject: [PATCH] revert to using UI becuase the remote command syntax breaks things on linux with vmware fusion. --- provisioner/windows-restart/provisioner.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/provisioner/windows-restart/provisioner.go b/provisioner/windows-restart/provisioner.go index 3b03cf116..0568516aa 100644 --- a/provisioner/windows-restart/provisioner.go +++ b/provisioner/windows-restart/provisioner.go @@ -3,6 +3,7 @@ package restart import ( "bytes" "fmt" + "io" "log" "strings" @@ -212,20 +213,15 @@ var waitForCommunicator = func(p *Provisioner) error { // provisioning before powershell is actually ready. // In this next check, we parse stdout to make sure that the command is // actually running as expected. - var stdout, stderr bytes.Buffer - cmdModuleLoad := &packer.RemoteCmd{ - Command: DefaultRestartCheckCommand, - Stdin: nil, - Stdout: &stdout, - Stderr: &stderr} + cmdModuleLoad := &packer.RemoteCmd{Command: DefaultRestartCheckCommand} + var buf, buf2 bytes.Buffer + cmdModuleLoad.Stdout = &buf + cmdModuleLoad.Stdout = io.MultiWriter(cmdModuleLoad.Stdout, &buf2) - p.comm.Start(cmdModuleLoad) - cmdModuleLoad.Wait() + cmdModuleLoad.StartWithUi(p.comm, p.ui) + stdoutToRead := buf2.String() - stdoutToRead := stdout.String() - stderrToRead := stderr.String() if !strings.Contains(stdoutToRead, "restarted.") { - log.Printf("Stderr is %s", stderrToRead) log.Printf("echo didn't succeed; retrying...") continue }