Bug 1776219 - Gracefully handle psutils failures in mach telemetry. r=firefox-build-system-reviewers,ahochheiden

On OpenBSD/i386, psutils fails in the generator used to enumerate the
active processes, breaking the build.

Differential Revision: https://phabricator.services.mozilla.com/D150462
This commit is contained in:
Alessio Placitelli 2022-06-29 09:03:28 +00:00
Родитель a0e2dc5103
Коммит 9fa5e395be
1 изменённых файлов: 18 добавлений и 19 удалений

Просмотреть файл

@ -242,25 +242,24 @@ def get_vscode_running():
"""Return if the vscode is currently running."""
try:
import psutil
for proc in psutil.process_iter():
try:
# On Windows we have "Code.exe"
# On MacOS we have "Code Helper (Renderer)"
# On Linux we have ""
if (
proc.name == "Code.exe"
or proc.name == "Code Helper (Renderer)"
or proc.name == "code"
):
return True
except Exception:
# may not be able to access process info for all processes
continue
except Exception:
psutil = None
if not psutil:
return None
for proc in psutil.process_iter():
try:
# On Windows we have "Code.exe"
# On MacOS we have "Code Helper (Renderer)"
# On Linux we have ""
if (
proc.name == "Code.exe"
or proc.name == "Code Helper (Renderer)"
or proc.name == "code"
):
return True
except Exception:
# may not be able to access process info for all processes
continue
# On some platforms, sometimes, the generator throws an
# exception preventing us to enumerate.
return False
return False