SOLR-6708: wrap the kill existing Solr command in a try/except block

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1640419 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy Potter 2014-11-18 20:30:37 +00:00
parent eaf211db6a
commit ad79399db1
1 changed files with 6 additions and 1 deletions

View File

@ -859,8 +859,13 @@ def testSolrExample(unpackPath, javaPath, isSrc):
env.update(os.environ)
env['JAVA_HOME'] = javaPath
env['PATH'] = '%s/bin:%s' % (javaPath, env['PATH'])
# Stop Solr running on port 8983 (in case a previous run didn't shutdown cleanly)
subprocess.call(['bin/solr','stop','-p','8983'])
try:
subprocess.call(['bin/solr','stop','-p','8983'])
except:
print(' Stop failed due to: '+sys.exc_info()[0])
print(' starting Solr on port 8983 from %s' % unpackPath)
server = subprocess.Popen(['bin/solr', '-f', '-p', '8983'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE, env=env)