Skip to content

Instantly share code, notes, and snippets.

@carlos8f
Created July 5, 2011 20:45
Show Gist options
  • Save carlos8f/1065878 to your computer and use it in GitHub Desktop.
Save carlos8f/1065878 to your computer and use it in GitHub Desktop.
Fix for Sphinx serverdensity plugin
--- Sphinx.py 2011-07-05 16:43:02.000000000 -0400
+++ Sphinx.py 2011-07-05 16:42:21.000000000 -0400
@@ -1,4 +1,5 @@
import subprocess
+import platform
class Sphinx:
def __init__(self, agentConfig, checksLogger, rawConfig):
@@ -14,7 +15,14 @@
self.checksLogger.debug('sphinx: start')
try:
self.checksLogger.debug('Sphinx: attempting Popen (searchd)')
- status = subprocess.Popen(['searchd', '--status'], stdout=subprocess.PIPE, clos$
+ proc = subprocess.Popen(['searchd', '--status'], stdout=subprocess.PIPE, close_fds=True)
+ status = proc.communicate()[0]
+ pythonVersion = platform.python_version_tuple()
+ if int(pythonVersion[1]) >= 6:
+ try:
+ proc.kill()
+ except OSError, e:
+ self.checksLogger.debug('Process already terminated')
except Exception, e:
import traceback
self.checksLogger.error('Sphinx: exception = ' + traceback.format_exc())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment