Set LD_LIBRARY_PATH only for zpool subprocess, not globally

This commit is contained in:
2026-03-07 03:48:46 +00:00
parent 4c033981c1
commit 034219c75e
2 changed files with 7 additions and 1 deletions

View File

@@ -17,4 +17,4 @@ services:
- TZ=America/Denver
- UVICORN_LOG_LEVEL=info
- ZPOOL_BIN=/host/zpool
- LD_LIBRARY_PATH=/host/lib
- ZFS_HOST_LIB=/host/lib

View File

@@ -15,10 +15,16 @@ async def get_zfs_pool_map() -> dict[str, str]:
"""
pool_map = {}
try:
env = os.environ.copy()
host_lib = os.environ.get("ZFS_HOST_LIB")
if host_lib:
env["LD_LIBRARY_PATH"] = host_lib
proc = await asyncio.create_subprocess_exec(
ZPOOL_BIN, "status", "-P",
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
env=env,
)
stdout, _ = await proc.communicate()
if proc.returncode != 0: