Merge pull request #10824 from briancain/exit-process-on-abort-triggers

Fixes #10823: Use Process.exit! for abort trigger option
This commit is contained in:
Brian Cain 2019-05-08 09:15:51 -07:00 committed by GitHub
commit 86800421db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -301,7 +301,7 @@ module Vagrant
# @param [Integer] code Code to exit Vagrant on
def trigger_abort(exit_code)
@ui.warn(I18n.t("vagrant.trigger.abort"))
exit(exit_code)
Process.exit!(exit_code)
end
# Calls the given ruby block for execution

View File

@ -414,12 +414,14 @@ describe Vagrant::Plugin::V2::Trigger do
context "#trigger_abort" do
it "system exits when called" do
allow(Process).to receive(:exit!).and_return(true)
output = ""
allow(machine.ui).to receive(:warn) do |data|
output << data
end
expect { subject.send(:trigger_abort, 3) }.to raise_error(SystemExit)
expect(Process).to receive(:exit!).with(3)
subject.send(:trigger_abort, 3)
end
end