From 173fd97ac86837de692f02ffa90428d3157f3f06 Mon Sep 17 00:00:00 2001 From: Andreas Oberritter Date: Sat, 11 Feb 2023 11:25:44 +0100 Subject: [PATCH] docker_compose_command: Accept 'docker compose' in config By splitting the command, we create a list that can be used with subprocess.run(). This allows to use simple paths as well as command-lines like "docker compose" to be specified in compose_executable. It also allows to pass more arguments to the process. This doesn't take into account any logic used by shells to quote strings or escape characters. We could use shlex.split() instead, if that's required. --- doxy/services.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doxy/services.py b/doxy/services.py index 6619e20..dd2bb22 100644 --- a/doxy/services.py +++ b/doxy/services.py @@ -41,5 +41,5 @@ def get_compose_file(service_path: Path) -> Path: def docker_compose_command(commands: List[str], compose_file: Path): ctx = click.get_current_context() config = ctx.obj["CONFIG"] - cmd = [config.compose_executable, "-f", compose_file] + list(commands) + cmd = config.compose_executable.split() + ["-f", compose_file] + list(commands) subprocess.run(cmd)