mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Add helper to check docker environment
This commit is contained in:
parent
c151e5f3a7
commit
fdf7bd7621
@ -987,6 +987,15 @@ class Helpers:
|
||||
def is_os_windows():
|
||||
return os.name == "nt"
|
||||
|
||||
@staticmethod
|
||||
def is_env_docker():
|
||||
path = "/proc/self/cgroup"
|
||||
return (
|
||||
os.path.exists("/.dockerenv")
|
||||
or os.path.isfile(path)
|
||||
and any("docker" in line for line in open(path, encoding="utf-8"))
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def wtol_path(w_path):
|
||||
l_path = w_path.replace("\\", "/")
|
||||
|
Loading…
Reference in New Issue
Block a user