go back to using StartWithUI to prevent weird hangs during windows reboot

This commit is contained in:
Megan Marsh 2018-08-23 11:05:44 -07:00
parent 5542b2b34a
commit c51cd751d1
1 changed files with 3 additions and 6 deletions

View File

@ -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
}
}