diff options
author | Matt Davis <nitzmahone@users.noreply.github.com> | 2017-03-24 00:02:39 -0700 |
---|---|---|
committer | Matt Davis <mdavis@ansible.com> | 2017-03-24 00:03:16 -0700 |
commit | 631eaccc64a66f38285a3fcd3c0a1060000935b9 (patch) | |
tree | 74d3a31369134a6e264d4fe4e8a54287cf167d2a /test/integration/targets/win_shell | |
parent | 43310bb7b7c85f941ec43d5604f1e5c04c9f64a4 (diff) | |
download | ansible-631eaccc64a66f38285a3fcd3c0a1060000935b9.tar.gz |
force Windows to always use preamble-free UTF8 input encoding (#22934)
* fixes #15770
* When running under the UTF-8 codepage, Powershell subprocesses will fail (eg, Start-Job, others) if the input encoding is using the default BOM preamble. This fix forces it to use no preamble in leaf_exec and win_shell, and includes tests to verify that Start-Job works.
(cherry picked from commit e084e8809e055dc5b1e711c518f22d6229b7d5d0)
Diffstat (limited to 'test/integration/targets/win_shell')
-rw-r--r-- | test/integration/targets/win_shell/tasks/main.yml | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/integration/targets/win_shell/tasks/main.yml b/test/integration/targets/win_shell/tasks/main.yml index 16759bb283..7d6ecf52c6 100644 --- a/test/integration/targets/win_shell/tasks/main.yml +++ b/test/integration/targets/win_shell/tasks/main.yml @@ -165,6 +165,16 @@ - shellout.stdout_lines == ["line1 ", "line2"] - shellout.stderr == "" +- name: test with job to ensure that preamble-free InputEncoding is working + win_shell: Start-Job { echo yo } | Receive-Job -Wait + register: shellout + +- name: check job result + assert: + that: + - shellout | succeeded + - shellout.stdout_lines[0] == 'yo' + - name: interleave large writes between stdout/stderr (check for buffer consumption deadlock) win_shell: $ba = New-Object byte[] 4096; (New-Object System.Random 32).NextBytes($ba); $text = [Convert]::ToBase64String($ba); Write-Output startout; Write-Error starterror; Write-Error $text; Write-Output $text; Write-Error $text; Write-Output $text; Write-Error $text; Write-Output $text; Write-Output doneout Write-Error doneerror register: shellout |