From 2995b6439db333c09f79e281127434af0b3e7e98 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 11 Jul 2012 18:32:51 -0700 Subject: [PATCH] Interrupt when asking to destroy a VM should exit. [GH-1017] --- CHANGELOG.md | 2 ++ plugins/commands/destroy/command.rb | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a42708bc1..fe848fcf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,8 @@ - FIx issue where puppet would reorder module paths. [GH-964] - Human-friendly error is raised if there are permission issues when using SCP to upload files. [GH-924] + - When console input is asked for (destroying a VM, bridged interfaces, etc.), + keystrokes such as ctrl-D and ctrl-C are more gracefully handled. [GH-1017] ## 1.0.3 (May 1, 2012) diff --git a/plugins/commands/destroy/command.rb b/plugins/commands/destroy/command.rb index d834bf34f..4ffa55395 100644 --- a/plugins/commands/destroy/command.rb +++ b/plugins/commands/destroy/command.rb @@ -32,6 +32,10 @@ module VagrantPlugins begin choice = @env.ui.ask(I18n.t("vagrant.commands.destroy.confirmation", :name => vm.name)) + rescue Interrupt + # Ctrl-C was pressed (or SIGINT). We just exit immediately + # with a non-zero exit status. + return 1 rescue Vagrant::Errors::UIExpectsTTY # We raise a more specific error but one which basically # means the same thing.