Skip to content

Commit

Permalink
Don't record port on Windows
Browse files Browse the repository at this point in the history
This won't work on Windows and is not needed.

Change-Id: I9b49d7d02925d9dafbefa39eb220712fe757bc7a
Partial-Bug: #1783539
  • Loading branch information
Michal Clapinski committed Jul 25, 2018
1 parent 0667e01 commit 3c13183
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions sandesh/library/python/pysandesh/sandesh_base.py
Expand Up @@ -24,6 +24,8 @@
import sandesh_logger as sand_logger
import trace
import util
import platform

from gen_py.sandesh.ttypes import SandeshType, SandeshLevel, \
SandeshTxDropReason
from gen_py.sandesh.constants import *
Expand Down Expand Up @@ -260,17 +262,18 @@ def kill_httpd(self):
self._logger.debug(str(e))

def record_port(self, name, port):
pipe_name = '/tmp/%s.%d.%s_port' % (self._module, os.getppid(), name)
try:
pipeout = os.open(pipe_name, os.O_WRONLY)
except Exception:
self._logger.error('Cannot write %s_port %d to %s'
% (name, port, pipe_name))
else:
self._logger.error('Writing %s_port %d to %s'
% (name, port, pipe_name))
os.write(pipeout, '%d\n' % port)
os.close(pipeout)
if platform.system() != 'Windows':
pipe_name = '/tmp/%s.%d.%s_port' % (self._module, os.getppid(), name)
try:
pipeout = os.open(pipe_name, os.O_WRONLY)
except Exception:
self._logger.error('Cannot write %s_port %d to %s'
% (name, port, pipe_name))
else:
self._logger.error('Writing %s_port %d to %s'
% (name, port, pipe_name))
os.write(pipeout, '%d\n' % port)
os.close(pipeout)

def logger(self):
return self._logger
Expand Down

0 comments on commit 3c13183

Please sign in to comment.