From cfeb289a69d47804109064ce6e87b05318971954 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Sat, 12 Nov 2016 07:17:29 -0800 Subject: [PATCH] Instance#wrap should abort gracefully when Solr is already running --- lib/solr_wrapper/instance.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/solr_wrapper/instance.rb b/lib/solr_wrapper/instance.rb index a227857..64d4291 100644 --- a/lib/solr_wrapper/instance.rb +++ b/lib/solr_wrapper/instance.rb @@ -59,11 +59,15 @@ def version end def wrap(&_block) - extract_and_configure - start - yield self - ensure - stop + raise "There is a Solr instance already running on port #{port}." if started? + + begin + extract_and_configure + start + yield self + ensure + stop + end end ##