From 79926937379c702177a7866f66eb81816cf2dddb Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 12 Nov 2013 16:20:52 +0000 Subject: [PATCH] builder/vmware: ctrl-c works during wait for boot --- CHANGELOG.md | 1 + builder/vmware/step_run.go | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98755ba44..7a12e211a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ BUG FIXES: * builder/virtualbox: Ctrl-C interrupts during waiting for boot. [GH-618] * builder/vmware: VMX modifications are now case-insensitive. [GH-608] * builder/vmware: VMware Fusion won't ask for VM upgrade. +* builder/vmware: Ctrl-C interrupts during waiting for boot. [GH-618] * provisioner/chef-solo: Output is slightly prettier and more informative. ## 0.3.11 (November 4, 2013) diff --git a/builder/vmware/step_run.go b/builder/vmware/step_run.go index 697c71752..d21f34ba1 100644 --- a/builder/vmware/step_run.go +++ b/builder/vmware/step_run.go @@ -65,7 +65,19 @@ func (s *stepRun) Run(state multistep.StateBag) multistep.StepAction { // Wait the wait amount if int64(config.bootWait) > 0 { ui.Say(fmt.Sprintf("Waiting %s for boot...", config.bootWait.String())) - time.Sleep(config.bootWait) + wait := time.After(config.bootWait) + WAITLOOP: + for { + select { + case <-wait: + break WAITLOOP + case <-time.After(1 * time.Second): + if _, ok := state.GetOk(multistep.StateCancelled); ok { + return multistep.ActionHalt + } + } + } + } return multistep.ActionContinue