Do not start status report on platform without AF_UNIX socket
issue11319 review393871002
This commit is contained in:
1 parent
5e78e9bccc
commit
f24c6e8e87
2 files changed
+10
-2
No files matched your search
+3
-2
@@ -128,7 +128,8 @@ def main(stdscr):
|
||||
processes[pid] = data
|
||||
refresh()
|
||||
refresh()
|
||||
status.listen(config.get('database', 'path'), update)
|
||||
return status.listen(config.get('database', 'path'), update)
|
||||
|
||||
|
||||
curses.wrapper(main)
|
||||
if not curses.wrapper(main):
|
||||
sys.stderr.write("status not supported on this platform\n")
|
||||
@@ -49,6 +49,8 @@ def log():
|
||||
|
||||
|
||||
def dump(path):
|
||||
if not hasattr(socket, 'AF_UNIX'):
|
||||
return False
|
||||
sock = socket.socket(socket.AF_UNIX)
|
||||
try:
|
||||
try:
|
||||
@@ -74,6 +76,8 @@ def dumper(path):
|
||||
|
||||
def start(path):
|
||||
global _PID, _PATH
|
||||
if not hasattr(socket, 'AF_UNIX'):
|
||||
return
|
||||
if _PID != os.getpid() and path: # Quick test without lock
|
||||
with _LOCK:
|
||||
if _PID != os.getpid():
|
||||
@@ -84,6 +88,8 @@ def start(path):
|
||||
|
||||
|
||||
def listen(path, callback=None):
|
||||
if not hasattr(socket, 'AF_UNIX'):
|
||||
return False
|
||||
sock = socket.socket(socket.AF_UNIX)
|
||||
socket_file = os.path.join(path, address)
|
||||
try:
|
||||
@@ -116,3 +122,4 @@ def listen(path, callback=None):
|
||||
finally:
|
||||
sock.close()
|
||||
os.unlink(socket_file)
|
||||
return True
|
||||
Reference in new issue
Block a user