|
|
|
@ -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:
|
|
|
|
|