diff --git a/docker-run-cli/src/docker_run/plugins/core.py b/docker-run-cli/src/docker_run/plugins/core.py index c395172..dc8dd99 100644 --- a/docker-run-cli/src/docker_run/plugins/core.py +++ b/docker-run-cli/src/docker_run/plugins/core.py @@ -61,6 +61,7 @@ def getExecFlags(cls, args: Dict[str, Any], unknown_args: List[str]) -> List[str def modifyFinalCommand(cls, cmd: List[str], args: Dict[str, Any], unknown_args: List[str]) -> List[str]: if "-v" in cmd or "--volume" in cmd: cmd = cls.resolveRelativeVolumeFlags(cmd) + cmd = cls.fixSpacesInVolumeFlags(cmd) return cmd @classmethod @@ -143,3 +144,10 @@ def resolveRelativeVolumeFlags(cls, cmd: List[str]) -> List[str]: absolute_mount_path = os.path.abspath(mount_path) cmd[i + 1] = absolute_mount_path + cmd[i + 1][len(mount_path):] return cmd + + @classmethod + def fixSpacesInVolumeFlags(cls, cmd: List[str]) -> List[str]: + for i, arg in enumerate(cmd): + if arg in ["-v", "--volume"]: + cmd[i + 1] = cmd[i + 1].replace(" ", "\\ ") + return cmd \ No newline at end of file