diff --git a/src/docker_mcp/docker_executor.py b/src/docker_mcp/docker_executor.py index e554905..d7810a7 100644 --- a/src/docker_mcp/docker_executor.py +++ b/src/docker_mcp/docker_executor.py @@ -74,10 +74,11 @@ async def run_command(self, command: str, *args) -> Tuple[int, str, str]: return await self.executor.execute(cmd) def _build_windows_command(self, command: str, *args) -> str: + import shlex compose_file = self.compose_file.replace('\\', '/') return (f'cd "{os.path.dirname(compose_file)}" && docker compose ' f'-f "{os.path.basename(compose_file)}" ' - f'-p {self.project_name} {command} {" ".join(args)}') + f'-p {shlex.quote(self.project_name)} {shlex.quote(command)} {" ".join(map(shlex.quote, args))}') def _build_unix_command(self, command: str, *args) -> list[str]: return [