- Timestamp:
- Aug 9, 2023 9:00:37 PM (19 months ago)
- svn:sync-xref-src-repo-rev:
- 158746
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testdriver/base.py
r99113 r100845 47 47 import socket 48 48 import stat 49 import subprocess50 49 import sys 51 50 import time … … 281 280 Checks if a process PID and NAME matches. 282 281 """ 283 if sys.platform == 'win32': 284 fRc = winbase.processCheckPidAndName(uPid, sName); 285 else: 286 sOs = utils.getHostOs(); 287 if sOs == 'linux': 288 asPsCmd = ['/bin/ps', '-p', '%u' % (uPid,), '-o', 'fname=']; 289 elif sOs == 'solaris': 290 asPsCmd = ['/usr/bin/ps', '-p', '%u' % (uPid,), '-o', 'fname=']; 291 elif sOs == 'darwin': 292 asPsCmd = ['/bin/ps', '-p', '%u' % (uPid,), '-o', 'ucomm=']; 293 else: 294 asPsCmd = None; 295 296 if asPsCmd is not None: 297 try: 298 oPs = subprocess.Popen(asPsCmd, stdout=subprocess.PIPE); # pylint: disable=consider-using-with 299 sCurName = oPs.communicate()[0]; 300 iExitCode = oPs.wait(); 301 except: 302 reporter.logXcpt(); 303 return False; 304 305 # ps fails with non-zero exit code if the pid wasn't found. 306 if iExitCode != 0: 307 return False; 308 if sCurName is None: 309 return False; 310 sCurName = sCurName.strip(); 311 if sCurName == '': 312 return False; 313 314 if os.path.basename(sName) == sName: 315 sCurName = os.path.basename(sCurName); 316 elif os.path.basename(sCurName) == sCurName: 317 sName = os.path.basename(sName); 318 319 if sCurName != sName: 320 return False; 321 322 fRc = True; 323 return fRc; 282 return utils.processCheckPidAndName(uPid, sName); 324 283 325 284 def wipeDirectory(sDir):
Note:
See TracChangeset
for help on using the changeset viewer.