1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Double echo temp directory name to handle spaces and ~ expansion both

Fixes #12667
This commit is contained in:
James Cammarata 2015-10-08 16:21:52 -04:00
parent d1b98ec776
commit 59d655c543

View file

@ -67,8 +67,8 @@ class ShellModule(object):
basetmp = self.join_path(C.DEFAULT_REMOTE_TMP, basefile) basetmp = self.join_path(C.DEFAULT_REMOTE_TMP, basefile)
if system and (basetmp.startswith('$HOME') or basetmp.startswith('~/')): if system and (basetmp.startswith('$HOME') or basetmp.startswith('~/')):
basetmp = self.join_path('/tmp', basefile) basetmp = self.join_path('/tmp', basefile)
cmd = 'mkdir -p "%s"' % basetmp cmd = 'mkdir -p "$(echo %s)"' % basetmp
cmd += ' && echo "%s"' % basetmp cmd += ' && echo "$(echo %s)"' % basetmp
# change the umask in a subshell to achieve the desired mode # change the umask in a subshell to achieve the desired mode
# also for directories created with `mkdir -p` # also for directories created with `mkdir -p`