diff --git a/plugins/commands/serve/util/service_info.rb b/plugins/commands/serve/util/service_info.rb index dfd109d7e..75a4c7611 100644 --- a/plugins/commands/serve/util/service_info.rb +++ b/plugins/commands/serve/util/service_info.rb @@ -24,16 +24,12 @@ module VagrantPlugins end Thread.current.thread_variable_set(:service_info, info) return if !block_given? - begin - yield info - rescue - raise - ensure - Service::ServiceInfo.manager_tracker.deactivate do - Vagrant.plugin("2").disable_remote_manager - end - Thread.current.thread_variable_set(:service_info, nil) + yield info + ensure + Service::ServiceInfo.manager_tracker.deactivate do + Vagrant.plugin("2").disable_remote_manager end + Thread.current.thread_variable_set(:service_info, nil) end end end diff --git a/test/unit/plugins/commands/serve/service/host_service_test.rb b/test/unit/plugins/commands/serve/service/host_service_test.rb index 3ca974755..eb8057171 100644 --- a/test/unit/plugins/commands/serve/service/host_service_test.rb +++ b/test/unit/plugins/commands/serve/service/host_service_test.rb @@ -65,7 +65,7 @@ describe VagrantPlugins::CommandServe::Service::HostService do it "raises an error for unknown plugins" do ctx = DummyContext.new("idontexisthahaha") - expect { subject.parent("", ctx) }.to raise_error(RuntimeError) + expect { subject.parent("", ctx) }.to raise_error(GRPC::BadStatus) end it "requests parent from plugins" do @@ -101,7 +101,7 @@ describe VagrantPlugins::CommandServe::Service::HostService do it "raises an error for unknown plugins" do ctx = DummyContext.new("idontexisthahaha") - expect { subject.detect("", ctx) }.to raise_error(RuntimeError) + expect { subject.detect("", ctx) }.to raise_error(GRPC::BadStatus) end it "detects true plugins" do