From 665f7c0f82a153e45c9845bae33cdb891839d805 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 7 May 2021 12:55:40 +0300 Subject: [PATCH] Fix problems of killing SALOME processes on Windows --- bin/killSalomeWithPort.py | 2 +- bin/salome_utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/killSalomeWithPort.py b/bin/killSalomeWithPort.py index a845475ce..d30d030b9 100755 --- a/bin/killSalomeWithPort.py +++ b/bin/killSalomeWithPort.py @@ -404,7 +404,7 @@ def __checkUnkilledProcesses(): 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']): diff --git a/bin/salome_utils.py b/bin/salome_utils.py index e919b2484..33fc6320a 100644 --- a/bin/salome_utils.py +++ b/bin/salome_utils.py @@ -451,7 +451,7 @@ def getOmniNamesPid(port): """ 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): -- 2.39.2