mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Only stat the .dockerenv file once (#76097)
This commit is contained in:
parent
cf849c59a4
commit
a628be4db8
@ -2,6 +2,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
from functools import cache
|
||||||
from importlib.metadata import PackageNotFoundError, version
|
from importlib.metadata import PackageNotFoundError, version
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@ -23,6 +24,7 @@ def is_virtual_env() -> bool:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@cache
|
||||||
def is_docker_env() -> bool:
|
def is_docker_env() -> bool:
|
||||||
"""Return True if we run in a docker env."""
|
"""Return True if we run in a docker env."""
|
||||||
return Path("/.dockerenv").exists()
|
return Path("/.dockerenv").exists()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user