From c51cd751d17a76b9ea5a7b011bb36ed58e8eef87 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Thu, 23 Aug 2018 11:05:44 -0700 Subject: [PATCH] go back to using StartWithUI to prevent weird hangs during windows reboot --- provisioner/windows-restart/provisioner.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/provisioner/windows-restart/provisioner.go b/provisioner/windows-restart/provisioner.go index 298e20802..3735cff73 100644 --- a/provisioner/windows-restart/provisioner.go +++ b/provisioner/windows-restart/provisioner.go @@ -124,11 +124,11 @@ var waitForRestart = func(p *Provisioner, comm packer.Communicator) error { for { log.Printf("Check if machine is rebooting...") cmd = &packer.RemoteCmd{Command: trycommand} - if err := p.comm.Start(cmd); err != nil { + err = cmd.StartWithUi(comm, ui) + if err != nil { // Couldn't execute, we assume machine is rebooting already break } - cmd.Wait() if cmd.ExitStatus == 1 { // SSH provisioner, and we're already rebooting. SSH can reconnect // without our help; exit this wait loop. @@ -143,10 +143,7 @@ var waitForRestart = func(p *Provisioner, comm packer.Communicator) error { if cmd.ExitStatus == 0 { // Cancel reboot we created to test if machine was already rebooting cmd = &packer.RemoteCmd{Command: abortcommand} - if err := p.comm.Start(cmd); err != nil { - return err - } - cmd.Wait() + cmd.StartWithUi(comm, ui) break } }