daun won't kill itself if not found process

This commit is contained in:
BarsTiger
2022-04-30 11:43:16 +03:00
parent 18448f4d20
commit 766ea3f0b8

View File

@@ -37,5 +37,5 @@ def kill(process_name: str = None, pid: int = None) -> None:
Stop a process by name or PID Stop a process by name or PID
""" """
if process_name: if process_name:
pid = get_pid(process_name) pid = get_pid(process_name) if pid != psutil.Process().pid else None
psutil.Process(pid).kill() psutil.Process(pid).kill()