diff --git a/builder/hyperv/common/step_shutdown.go b/builder/hyperv/common/step_shutdown.go index e22234e27..84a20c26b 100644 --- a/builder/hyperv/common/step_shutdown.go +++ b/builder/hyperv/common/step_shutdown.go @@ -4,10 +4,11 @@ import ( "bytes" "errors" "fmt" - "github.com/mitchellh/multistep" - "github.com/mitchellh/packer/packer" "log" "time" + + "github.com/mitchellh/multistep" + "github.com/mitchellh/packer/packer" ) // This step shuts down the machine. It first attempts to do so gracefully, @@ -51,14 +52,6 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionHalt } - // Wait for the command to run so we can print std{err,out} - // We don't care if the command errored, since we'll notice - // if the vm didn't shut down. - cmd.Wait() - - log.Printf("Shutdown stdout: %s", stdout.String()) - log.Printf("Shutdown stderr: %s", stderr.String()) - // Wait for the machine to actually shut down log.Printf("Waiting max %s for shutdown to complete", s.Timeout) shutdownTimer := time.After(s.Timeout) @@ -70,12 +63,14 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { select { case <-shutdownTimer: + log.Printf("Shutdown stdout: %s", stdout.String()) + log.Printf("Shutdown stderr: %s", stderr.String()) err := errors.New("Timeout while waiting for machine to shut down.") state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt default: - time.Sleep(150 * time.Millisecond) + time.Sleep(500 * time.Millisecond) } } } else {