diff options
author | Jordan Borean <jborean93@gmail.com> | 2019-06-17 05:14:58 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-17 05:14:58 +1000 |
commit | d0c49144691a35c192d5a144c61e39fbb3b48f38 (patch) | |
tree | 3a9247cd3bc8d74b04f37e95dc06c9af5504d03b /test/integration/targets/win_shell | |
parent | 0f2903780bf8dfefb62247cad768f25858de7d73 (diff) | |
download | ansible-d0c49144691a35c192d5a144c61e39fbb3b48f38.tar.gz |
win_shell - fix space escaping for custom executable (#57455)
Diffstat (limited to 'test/integration/targets/win_shell')
-rw-r--r-- | test/integration/targets/win_shell/tasks/main.yml | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/test/integration/targets/win_shell/tasks/main.yml b/test/integration/targets/win_shell/tasks/main.yml index eb388b5b11..490caff0ee 100644 --- a/test/integration/targets/win_shell/tasks/main.yml +++ b/test/integration/targets/win_shell/tasks/main.yml @@ -269,7 +269,7 @@ - no_profile is changed - no_profile.cmd == "[System.Environment]::CommandLine" - no_profile.rc == 0 - - no_profile.stdout is match ('^powershell.exe -noninteractive -encodedcommand') + - no_profile.stdout is match ('^"powershell.exe" -noninteractive -encodedcommand') - name: execute powershell with no_profile win_shell: '[System.Environment]::CommandLine' @@ -284,4 +284,33 @@ - no_profile is changed - no_profile.cmd == "[System.Environment]::CommandLine" - no_profile.rc == 0 - - no_profile.stdout is match ('^powershell.exe -noprofile -noninteractive -encodedcommand') + - no_profile.stdout is match ('^"powershell.exe" -noprofile -noninteractive -encodedcommand') + +- name: create symbolic link with space in the path + win_command: cmd.exe /c mklink /d "C:\ansible test link" C:\Windows\System32\WindowsPowerShell\v1.0 + args: + creates: C:\ansible test link + +- block: + - name: run with space in the executable path + win_shell: '[System.Environment]::CommandLine' + args: + executable: C:\ansible test link\powershell + register: space_exe + + - debug: + var: space_exe.stdout|trim + + - name: assert run with space in the executable path + assert: + that: + - space_exe is successful + - space_exe is changed + - space_exe.cmd == '[System.Environment]::CommandLine' + - space_exe.rc == 0 + - space_exe.stdout|trim == '"C:\\ansible test link\\powershell.exe" /c [System.Environment]::CommandLine' + always: + - name: remove test symbolic link + win_file: + path: C:\ansible test link + state: absent |