From a553b1c62dc436a3406a4ff3b17e71f2f617082c Mon Sep 17 00:00:00 2001 From: mansikulkarni96 Date: Tue, 7 Jul 2026 15:35:23 -0400 Subject: [PATCH] Fix infinite reboot on SSH exit command status --- pkg/windows/windows.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/windows/windows.go b/pkg/windows/windows.go index fcaa5224fe..7bf43a90c6 100644 --- a/pkg/windows/windows.go +++ b/pkg/windows/windows.go @@ -492,7 +492,9 @@ func (vm *windows) Run(cmd string, psCmd bool) (string, error) { // RebootAndReinitialize restarts the Windows instance and re-initializes the SSH connection for further configuration func (vm *windows) RebootAndReinitialize(ctx context.Context) error { vm.log.Info("rebooting instance") - if _, err := vm.Run("Restart-Computer -Force", true); err != nil { + // SSH connection may terminate during reboot before returning exit status - this is expected + // The real validation is waitUntilUnreachable() and reinitialize(), so we only fail on unexpected errors + if _, err := vm.Run("Restart-Computer -Force", true); err != nil && !strings.Contains(err.Error(), cmdExitNoStatus) { return fmt.Errorf("error rebooting the Windows VM: %w", err) } // Wait for instance to be unreachable via SSH, implies reboot is underway