core: ctrl-c no longer raises trap-context exception

This commit is contained in:
Mitchell Hashimoto 2013-12-30 12:42:21 -08:00
parent 28720b181d
commit 757ad016b1
2 changed files with 10 additions and 5 deletions

View File

@ -6,6 +6,7 @@ IMPROVEMENTS:
BUG FIXES: BUG FIXES:
- core: Ctrl-C no longer raises "trap context" exception.
- core: The version for `Vagrant.configure` can now be an int. [GH-2689] - core: The version for `Vagrant.configure` can now be an int. [GH-2689]
- core: `Vagrant.has_plugin?` tries to use plugin's gem name before - core: `Vagrant.has_plugin?` tries to use plugin's gem name before
registered plugin name [GH-2617] registered plugin name [GH-2617]

View File

@ -180,11 +180,15 @@ module Vagrant
channel = type == :error || opts[:channel] == :error ? $stderr : $stdout channel = type == :error || opts[:channel] == :error ? $stderr : $stdout
# Output! We wrap this in a lock so that it safely outputs only # Output! We wrap this in a lock so that it safely outputs only
# one line at a time. # one line at a time. We wrap this in a thread because as of Ruby 2.0
@lock.synchronize do # we can't acquire locks in a trap context (ctrl-c), so we have to
safe_puts(format_message(type, message, opts), # do this.
:io => channel, :printer => printer) Thread.new do
end @lock.synchronize do
safe_puts(format_message(type, message, opts),
:io => channel, :printer => printer)
end
end.join
end end
def scope(scope_name) def scope(scope_name)