mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
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.
This commit is contained in:
parent
cd662efd2b
commit
e084e8809e
4 changed files with 26 additions and 0 deletions
|
@ -115,3 +115,13 @@
|
|||
that:
|
||||
- "not raw_with_items_result|failed"
|
||||
- "raw_with_items_result.results|length == 32"
|
||||
|
||||
- name: test raw with job to ensure that preamble-free InputEncoding is working
|
||||
raw: Start-Job { echo yo } | Receive-Job -Wait
|
||||
register: raw_job_result
|
||||
|
||||
- name: check raw with job result
|
||||
assert:
|
||||
that:
|
||||
- raw_job_result | succeeded
|
||||
- raw_job_result.stdout_lines[0] == 'yo'
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue