From e101b031fc2709074564ae4630105b30d5915d7e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 12 Jun 2013 10:47:55 -0700 Subject: [PATCH] builder/virtualbox: Cancel mid-type if we can --- builder/virtualbox/step_type_boot_command.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/builder/virtualbox/step_type_boot_command.go b/builder/virtualbox/step_type_boot_command.go index c5726088b..6257aa435 100644 --- a/builder/virtualbox/step_type_boot_command.go +++ b/builder/virtualbox/step_type_boot_command.go @@ -59,6 +59,12 @@ func (s *stepTypeBootCommand) Run(state map[string]interface{}) multistep.StepAc continue } + // Since typing is sometimes so slow, we check for an interrupt + // in between each character. + if _, ok := state[multistep.StateCancelled]; ok { + return multistep.ActionHalt + } + if err := driver.VBoxManage("controlvm", vmName, "keyboardputscancode", code); err != nil { ui.Error(fmt.Sprintf("Error sending boot command: %s", err)) return multistep.ActionHalt