builder/virtualbox: Cancel mid-type if we can

This commit is contained in:
Mitchell Hashimoto 2013-06-12 10:47:55 -07:00
parent 2de0238f10
commit e101b031fc

View File

@ -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