mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix win_dsc tests
This commit is contained in:
parent
0fcde71062
commit
68d18b2ad3
1 changed files with 8 additions and 2 deletions
|
@ -291,8 +291,14 @@ def _prep_powershell_cmd(win_shell, cmd, encoded_cmd):
|
|||
if isinstance(cmd, list):
|
||||
cmd = " ".join(cmd)
|
||||
|
||||
if cmd.startswith("$"):
|
||||
new_cmd.extend(["-Command", f"{cmd.strip()}"])
|
||||
# Commands that are a specific keyword behave differently. They fail if
|
||||
# you add a "&" to the front. Add those here as we find them:
|
||||
keywords = ["$", "&", ".", "Configuration"]
|
||||
|
||||
for keyword in keywords:
|
||||
if cmd.startswith(keyword):
|
||||
new_cmd.extend(["-Command", f"{cmd.strip()}"])
|
||||
break
|
||||
else:
|
||||
new_cmd.extend(["-Command", f"& {cmd.strip()}"])
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue