Skip to content

Commit

Permalink
Fix check_already_running() to allow xargs usage
Browse files Browse the repository at this point in the history
  • Loading branch information
double16 committed Oct 17, 2024
1 parent 08cb30b commit cd76afd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions dvrprocess/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,8 +921,13 @@ def check_already_running(quiet=False):
others = []
for p in psutil.process_iter():
try:
if my_name in " ".join(p.cmdline()) and p.pid != os.getpid():
others.append(p)
if p.pid != os.getpid():
cmdline = list(p.cmdline())
if len(cmdline) > 0:
if 'python' in os.path.basename(cmdline[0]).lower():
cmdline.pop(0)
if len(cmdline) > 0 and my_name in cmdline[0]:
others.append(p)
except (PermissionError, AccessDenied, ProcessLookupError, NoSuchProcess):
pass
if len(others) > 0:
Expand Down

0 comments on commit cd76afd

Please sign in to comment.