try to retype key if an error is received (#10541)

This commit is contained in:
jhawk28 2021-03-19 08:27:05 -04:00 committed by GitHub
parent 7c6c399a38
commit 9f647ba2bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -98,9 +98,21 @@ func (s *StepBootCommand) Run(ctx context.Context, state multistep.StateBag) mul
Alt: keyAlt,
Shift: shift,
})
if err != nil {
// retry once if error
ui.Error(fmt.Errorf("error typing a boot command (code, down) `%d, %t`: %w", code, down, err).Error())
ui.Say("trying key input again")
time.Sleep(s.Config.BootGroupInterval)
_, err = vm.TypeOnKeyboard(driver.KeyInput{
Scancode: code,
Ctrl: keyCtrl,
Alt: keyAlt,
Shift: shift,
})
if err != nil {
return fmt.Errorf("error typing a boot command (code, down) `%d, %t`: %w", code, down, err)
}
}
return nil
}
d := bootcommand.NewUSBDriver(sendCodes, s.Config.BootGroupInterval)