Handle process in container

This commit is contained in:
Ivan Kravets committed 2016-09-29 23:53:19 +03:00
1 parent 5cfca6b1f6
commit bee52c715e
3 files changed
+21 -5

No files matched your search

+11
View File
@@ -298,6 +298,17 @@ def is_ci():
return os.getenv("CI", "").lower() == "true"
def is_container():
if not isfile("/proc/1/cgroup"):
return False
with open("/proc/1/cgroup") as fp:
for line in fp:
line = line.strip()
if ":" in line and not line.endswith(":/"):
return True
return False
def exec_command(*args, **kwargs):
result = {"out": None, "err": None, "returncode": None}