cape: linux: handle no environ

This commit is contained in:
Willi Ballenthin
2025-03-19 16:03:10 +00:00
parent 4008775786
commit 664a6d8043
2 changed files with 4 additions and 1 deletions

View File

@@ -324,8 +324,8 @@ class Process(FlexibleModel):
# module_path: str
# first_seen: str
calls: list[Call]
environ: dict[str, str]
threads: list[int] | None = None # this can be None for CAPE for Linux, which doesn't track threads.
environ: dict[str, str] = Field(default_factory=dict) # type: ignore
"""

View File

@@ -49,6 +49,9 @@ def extract_environ_strings(ph: ProcessHandle) -> Iterator[tuple[Feature, Addres
"""
process: Process = ph.inner
if not process.environ:
return
for value in (value for value in process.environ.values() if value):
yield String(value), ph.address