is_docker() fix for show=True predict bug (#218)

Co-authored-by: Hardik Dava <39372750+hardikdava@users.noreply.github.com>
Co-authored-by: Onuralp Sezer <thunderbirdtr@fedoraproject.org>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Glenn Jocher
2023-01-11 00:37:07 +01:00
committed by GitHub
parent 7f9d7142c2
commit 88c9418087
3 changed files with 8 additions and 5 deletions

View File

@ -119,8 +119,12 @@ def is_docker() -> bool:
Returns:
bool: True if the script is running inside a Docker container, False otherwise.
"""
with open('/proc/self/cgroup') as f:
return 'docker' in f.read()
file = Path('/proc/self/cgroup')
if file.exists():
with open(file) as f:
return 'docker' in f.read()
else:
return False
def is_git_directory() -> bool: