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:
commit
86800421db
|
@ -301,7 +301,7 @@ module Vagrant
|
||||||
# @param [Integer] code Code to exit Vagrant on
|
# @param [Integer] code Code to exit Vagrant on
|
||||||
def trigger_abort(exit_code)
|
def trigger_abort(exit_code)
|
||||||
@ui.warn(I18n.t("vagrant.trigger.abort"))
|
@ui.warn(I18n.t("vagrant.trigger.abort"))
|
||||||
exit(exit_code)
|
Process.exit!(exit_code)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Calls the given ruby block for execution
|
# Calls the given ruby block for execution
|
||||||
|
|
|
@ -414,12 +414,14 @@ describe Vagrant::Plugin::V2::Trigger do
|
||||||
|
|
||||||
context "#trigger_abort" do
|
context "#trigger_abort" do
|
||||||
it "system exits when called" do
|
it "system exits when called" do
|
||||||
|
allow(Process).to receive(:exit!).and_return(true)
|
||||||
output = ""
|
output = ""
|
||||||
allow(machine.ui).to receive(:warn) do |data|
|
allow(machine.ui).to receive(:warn) do |data|
|
||||||
output << data
|
output << data
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue