def _checkUserName(_process):
# The following is a workaround for Windows on which
# psutil.Process().username() returns 'usergroup' + 'username'
- return getUserName() == _process.username()
+ return getUserName() == _process.username().split('\\')[-1]
def _getDictfromOutput(_processes, _wildcard=None):
for _process in psutil.process_iter(['name', 'username']):
"""
processes = {p.info['pid']: p.info['name'] for p in psutil.process_iter(['pid', 'name'])}
return next((c.pid for c in psutil.net_connections(kind='inet') \
- if c.laddr.port == port and processes.get(c.pid) == 'omniNames'), None)
+ if str(c.laddr.port) == str(port) and processes.get(c.pid).startswith('omniNames')), None)
# --
def killOmniNames(port):