Skip to content

Commit

Permalink
Update in_docker function in precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
bensampson5 committed May 26, 2024
1 parent e7bafbe commit a6e7994
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions tools/precommit.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@

def in_docker():
"""Returns: True if running in a docker container, else False"""
try:
with open("/proc/1/cgroup", "rt") as ifh:
contents = ifh.read()
return any([word in contents for word in ["actions_job", "docker"]])
except OSError:
return False
return Path("/.dockerenv").exists()


def run(cmd, cwd=PROJECT_ROOT, check_exit=True, print_output=True):
Expand Down

0 comments on commit a6e7994

Please sign in to comment.