Skip to content

Commit

Permalink
fix spaces in volume flags
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbusch committed Apr 9, 2024
1 parent 3564c64 commit 3c98e68
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docker-run-cli/src/docker_run/plugins/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 3c98e68

Please sign in to comment.