Created
July 5, 2011 20:45
-
-
Save carlos8f/1065878 to your computer and use it in GitHub Desktop.
Fix for Sphinx serverdensity plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- 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