pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/pre-commit/pre-commit/commit/b7ce5db782c0965aae064f7040177a702ca5e930

f="https://github.githubassets.com/assets/global-d18f184ea1a06a2c.css" /> Use fallback uid and gid if os.getuid() and os.getgid() are unavailable · pre-commit/pre-commit@b7ce5db · GitHub
Skip to content

Commit b7ce5db

Browse files
committed
Use fallback uid and gid if os.getuid() and os.getgid() are unavailable
1 parent 1bd9bfe commit b7ce5db

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

pre_commit/languages/docker.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
ENVIRONMENT_DIR = 'docker'
1616
PRE_COMMIT_LABEL = 'PRE_COMMIT'
17+
FALLBACK_UID = 1000
18+
FALLBACK_GID = 1000
1719
get_default_version = helpers.basic_get_default_version
1820
healthy = helpers.basic_healthy
1921

@@ -73,11 +75,25 @@ def install_environment(
7375
os.mkdir(directory)
7476

7577

78+
def getuid():
79+
try:
80+
return os.getuid()
81+
except AttributeError:
82+
return FALLBACK_UID
83+
84+
85+
def getgid():
86+
try:
87+
return os.getgid()
88+
except AttributeError:
89+
return FALLBACK_GID
90+
91+
7692
def docker_cmd(): # pragma: windows no cover
7793
return (
7894
'docker', 'run',
7995
'--rm',
80-
'-u', '{}:{}'.format(os.getuid(), os.getgid()),
96+
'-u', '{}:{}'.format(getuid(), getgid()),
8197
# https://docs.docker.com/engine/reference/commandline/run/#mount-volumes-from-container-volumes-from
8298
# The `Z` option tells Docker to label the content with a private
8399
# unshared label. Only the current container can use a private volume.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy