From 72fc6002c1e22a596761d3e66a7079e483b85050 Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Sun, 31 Jul 2022 09:25:32 +0000 Subject: [PATCH] ComposeContainer.exec: Rewrite to execute command directly --- podman-compose-backup.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/podman-compose-backup.py b/podman-compose-backup.py index d40e0c7..f10f2dc 100644 --- a/podman-compose-backup.py +++ b/podman-compose-backup.py @@ -311,21 +311,24 @@ class ComposeContainer: def depends_on(self) -> Sequence[ComposeContainer]: return [self.compose.services[name] for name in self.base.get("depends_on", [])] - def exec_cmd( + def exec( self, command: CommandArgs, + check: bool = True, workdir: Optional[str] = None, - ) -> CommandArgs: - return combine_cmds( - PODMAN_EXEC, - [ - "container", - "exec", - "--interactive=false", - None if workdir is None else f"--workdir={workdir}", - self.container_name, - ], - command, + ) -> CompletedProcess: + return self.compose.podman.exec_podman( + command=combine_cmds( + [ + "container", + "exec", + "--interactive=false", + None if workdir is None else f"--workdir={workdir}", + self.container_name, + ], + command, + ), + check=check, )