Skip to content

Commit 2210539

Browse files
committed
Raise a ValueError if lscpu runs into issues. Fixes #501.
1 parent dbb8532 commit 2210539

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/blosc2/core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,10 @@ def get_cache_info(cache_level: int) -> tuple:
11731173
if cache_level == 0:
11741174
cache_level = "1d"
11751175

1176-
result = subprocess.run(["lscpu", "--json"], capture_output=True, check=True, text=True)
1176+
try:
1177+
result = subprocess.run(["lscpu", "--json"], capture_output=True, check=True, text=True)
1178+
except (FileNotFoundError, subprocess.CalledProcessError) as err:
1179+
raise ValueError("lscpu not found or error running lscpu") from err
11771180
lscpu_info = json.loads(result.stdout)
11781181
for entry in lscpu_info["lscpu"]:
11791182
if entry["field"] == f"L{cache_level} cache:":

0 commit comments

Comments
 (0)