mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
WinRM/PSRP: Ensure shell returns UTF-8 output (#47404)
* WinRM/PSRP: Ensure shell returns UTF-8 output This PR makes UTF-8 output work in PSRP shells. * Add win_command and win_shell integration tests * Fix tests * more test fixes
This commit is contained in:
committed by
Jordan Borean
parent
8a88d78285
commit
691ff4b9e6
@@ -59,3 +59,27 @@
|
||||
assert:
|
||||
that:
|
||||
- async_out.stdout_lines == ["abc"]
|
||||
|
||||
- name: Output unicode characters from Powershell using PSRP
|
||||
win_command: "powershell.exe -ExecutionPolicy ByPass -Command \"Write-Host '\U0001F4A9'\""
|
||||
register: command_unicode_output
|
||||
|
||||
- name: Assert unicode output
|
||||
assert:
|
||||
that:
|
||||
- command_unicode_output is changed
|
||||
- command_unicode_output.rc == 0
|
||||
- "command_unicode_output.stdout == '\U0001F4A9\n'"
|
||||
- command_unicode_output.stderr == ''
|
||||
|
||||
- name: Output unicode characters from Powershell using PSRP
|
||||
win_shell: "Write-Host '\U0001F4A9'"
|
||||
register: shell_unicode_output
|
||||
|
||||
- name: Assert unicode output
|
||||
assert:
|
||||
that:
|
||||
- shell_unicode_output is changed
|
||||
- shell_unicode_output.rc == 0
|
||||
- "shell_unicode_output.stdout == '\U0001F4A9\n'"
|
||||
- shell_unicode_output.stderr == ''
|
||||
|
||||
@@ -76,6 +76,12 @@ Assert-Equals -actual $actual.rc -expected 0
|
||||
Assert-Equals -actual $actual.stdout -expected "stdout `r`n"
|
||||
Assert-Equals -actual $actual.stderr -expected "stderr `r`n"
|
||||
|
||||
$test_name = "Test UTF8 output from stdout stream"
|
||||
$actual = Run-Command -command "powershell.exe -ExecutionPolicy ByPass -Command `"Write-Host '💩'`""
|
||||
Assert-Equals -actual $actual.rc -expected 0
|
||||
Assert-Equals -actual $actual.stdout -expected "💩`n"
|
||||
Assert-Equals -actual $actual.stderr -expected ""
|
||||
|
||||
$test_name = "test default environment variable"
|
||||
Set-Item -Path env:TESTENV -Value "test"
|
||||
$actual = Run-Command -command "cmd.exe /c set"
|
||||
|
||||
Reference in New Issue
Block a user