From 5e324d6bb4b25a56e8629b7d2c0b1c9c6eac74a1 Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Mon, 12 Dec 2016 10:33:24 -0800 Subject: [PATCH] apply #4041 to hyperV builder --- builder/hyperv/common/step_shutdown.go | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/builder/hyperv/common/step_shutdown.go b/builder/hyperv/common/step_shutdown.go index db60a1517..e22234e27 100644 --- a/builder/hyperv/common/step_shutdown.go +++ b/builder/hyperv/common/step_shutdown.go @@ -51,22 +51,13 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionHalt } - // Wait for the command to run + // 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() - stderrString := stderr.String() - stdoutString := stdout.String() - - // If the command failed to run, notify the user in some way. - if !(cmd.ExitStatus == 0 || (cmd.ExitStatus == 1 && len(stderrString) == 0)) { - state.Put("error", fmt.Errorf( - "Shutdown command has not successful.\n\nExitStatus: %d\n\nStdout: %s\n\nStderr: %s", - cmd.ExitStatus, stdoutString, stderrString)) - return multistep.ActionHalt - } - - log.Printf("Shutdown stdout: %s", stdoutString) - log.Printf("Shutdown stderr: %s", stderrString) + 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)