mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 03:11:24 -07:00
fix to alllow the winrm plugin to send input with Python 3 (#27474)
This commit is contained in:
parent
e4d153bd5d
commit
1517db06c5
2 changed files with 5 additions and 5 deletions
|
@ -1379,8 +1379,8 @@ class ShellModule(object):
|
|||
|
||||
# non-pipelining
|
||||
|
||||
cmd_parts = shlex.split(to_bytes(cmd), posix=False)
|
||||
cmd_parts = map(to_text, cmd_parts)
|
||||
cmd_parts = shlex.split(cmd, posix=False)
|
||||
cmd_parts = list(map(to_text, cmd_parts))
|
||||
if shebang and shebang.lower() == '#!powershell':
|
||||
if not self._unquote(cmd_parts[0]).lower().endswith('.ps1'):
|
||||
cmd_parts[0] = '"%s.ps1"' % self._unquote(cmd_parts[0])
|
||||
|
@ -1480,7 +1480,7 @@ class ShellModule(object):
|
|||
script = u'%s\r\nIf (-not $?) { If (Get-Variable LASTEXITCODE -ErrorAction SilentlyContinue) { exit $LASTEXITCODE } Else { exit 1 } }\r\n'\
|
||||
% script
|
||||
script = '\n'.join([x.strip() for x in script.splitlines() if x.strip()])
|
||||
encoded_script = base64.b64encode(script.encode('utf-16-le'))
|
||||
encoded_script = to_text(base64.b64encode(script.encode('utf-16-le')), 'utf-8')
|
||||
cmd_parts = _common_args + ['-EncodedCommand', encoded_script]
|
||||
|
||||
if as_list:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue