mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-16 02:21:46 +04:00
add AttributeError again
This commit is contained in:
parent
a8887d2cfe
commit
4416c3d512
1 changed files with 15 additions and 9 deletions
|
|
@ -78,15 +78,21 @@ def install_environment(
|
||||||
|
|
||||||
|
|
||||||
def get_docker_user() -> Tuple[str, ...]: # pragma: win32 no cover
|
def get_docker_user() -> Tuple[str, ...]: # pragma: win32 no cover
|
||||||
output = subprocess.check_output(('docker', 'system', 'info'), text=True)
|
try:
|
||||||
for line in output.splitlines():
|
output = subprocess.check_output(
|
||||||
# rootless docker has "rootless"
|
('docker', 'system', 'info'),
|
||||||
# rootless podman has "rootless: true"
|
text=True,
|
||||||
if line.strip().startswith('rootless'):
|
)
|
||||||
if not 'false' in line:
|
for line in output.splitlines():
|
||||||
return () # no -u for rootless
|
# rootless docker has "rootless"
|
||||||
break
|
# rootless podman has "rootless: true"
|
||||||
return ('-u', f'{os.getuid()}:{os.getgid()}')
|
if line.strip().startswith('rootless'):
|
||||||
|
if 'false' not in line:
|
||||||
|
return () # no -u for rootless
|
||||||
|
break
|
||||||
|
return ('-u', f'{os.getuid()}:{os.getgid()}')
|
||||||
|
except AttributeError:
|
||||||
|
return ()
|
||||||
|
|
||||||
|
|
||||||
def docker_cmd() -> Tuple[str, ...]: # pragma: win32 no cover
|
def docker_cmd() -> Tuple[str, ...]: # pragma: win32 no cover
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue