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 ##