Skip to content

Commit 5a37348

Browse files
authored
Bump gProfiler version (1.1.2) (#117)
* Bump gProfiler version * utils: Handle processes dying while iterating on pgrep_maps() results * utils: Add missing return in random_prefix()
1 parent b2c886a commit 5a37348

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

gprofiler/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.1.1"
1+
__version__ = "1.1.2"

gprofiler/utils.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,10 @@ def pgrep_maps(match: str) -> List[Process]:
207207
for line in result.stdout.splitlines():
208208
assert line.startswith(b"/proc/") and line.endswith(b"/maps"), f"unexpected 'grep' line: {line!r}"
209209
pid = int(line[len(b"/proc/") : -len(b"/maps")])
210-
processes.append(Process(pid))
210+
try:
211+
processes.append(Process(pid))
212+
except psutil.NoSuchProcess:
213+
continue # process might have died meanwhile
211214

212215
return processes
213216

@@ -500,5 +503,5 @@ def get_hostname() -> str:
500503
return hostname
501504

502505

503-
def random_prefix():
504-
''.join(random.choice(string.ascii_letters) for _ in range(16))
506+
def random_prefix() -> str:
507+
return ''.join(random.choice(string.ascii_letters) for _ in range(16))

0 commit comments

Comments
 (0)