mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Collapse extra whitespace in encoded powershell scripts.
This commit is contained in:
parent
df8866b8bd
commit
43a7a5a990
1 changed files with 1 additions and 0 deletions
|
@ -46,6 +46,7 @@ def _escape(value, include_vars=False):
|
|||
|
||||
def _encode_script(script, as_list=False):
|
||||
'''Convert a PowerShell script to a single base64-encoded command.'''
|
||||
script = '\n'.join([x.strip() for x in script.splitlines() if x.strip()])
|
||||
encoded_script = base64.b64encode(script.encode('utf-16-le'))
|
||||
cmd_parts = _common_args + ['-EncodedCommand', encoded_script]
|
||||
if as_list:
|
||||
|
|
Loading…
Reference in a new issue