Skip to content

Commit

Permalink
Fix: Do not crash with stack trace on expectable error
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdinandjarisch committed Dec 11, 2024
1 parent 7a9b9d8 commit f47f157
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/gallia/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,11 @@ def net_if_addrs() -> list[Interface]:
if sys.platform != "linux":
raise NotImplementedError("net_if_addrs() is only supported on Linux platforms")

p = subprocess.run(["ip", "-j", "address", "show"], capture_output=True, check=True)
try:
p = subprocess.run(["ip", "-j", "address", "show"], capture_output=True, check=True)
except FileNotFoundError as e:
logger.warning(f"Could not query information about interfaces: {e}")
return []

try:
return [Interface(**item) for item in json.loads(p.stdout.decode())]
Expand Down

0 comments on commit f47f157

Please sign in to comment.