fix process.get_processes_by_path's path judgement

This commit is contained in:
Prodesire 2018-01-27 11:09:01 +08:00
parent d79251168d
commit f07f2dd24b
1 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,8 @@ try:
except ImportError: except ImportError:
raise ImportError('Need to pip install psutil if you use pydu.process') raise ImportError('Need to pip install psutil if you use pydu.process')
from .path import is_super_path
def get_processes_by_path(path): def get_processes_by_path(path):
""" """
@ -21,7 +23,7 @@ def get_processes_by_path(path):
using_paths.extend(pinfo['open_files']) using_paths.extend(pinfo['open_files'])
for using_path in using_paths: for using_path in using_paths:
if path not in using_path: if is_super_path(path, using_path):
continue continue
pinfos.append({ pinfos.append({
'pid': pinfo['pid'], 'pid': pinfo['pid'],