Skip to content

Commit 8f7ce22

Browse files
authored
fix(dev): handle NoneType error in monitor script (yondonfu#155)
This commit fixes a NoneType error in the resource monitoring script that occurs when certain processes lack a name.
1 parent fc0f6ef commit 8f7ce22

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/monitor_pid_resources.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def find_pid_by_name(name: str) -> int:
129129
Process ID of the process with the given name.
130130
"""
131131
for proc in psutil.process_iter(["pid", "name", "cmdline"]):
132-
if name in proc.info["cmdline"]:
132+
if proc.info["cmdline"] and name in proc.info["cmdline"]:
133133
found_pid = proc.info["pid"]
134134
click.echo(
135135
click.style(f"Found process '{name}' with PID {found_pid}.", fg="green")

0 commit comments

Comments
 (0)