mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-22 03:53:59 -07:00
win_command win_shell: add stdin option (#31619)
This commit is contained in:
parent
b663f602bc
commit
8e44cd5d10
6 changed files with 85 additions and 4 deletions
|
@ -178,3 +178,18 @@
|
|||
win_file:
|
||||
path: C:\ansible testing
|
||||
state: absent
|
||||
|
||||
- name: run stdin test
|
||||
win_command: powershell.exe -
|
||||
args:
|
||||
stdin: Write-Host "some input"
|
||||
register: cmdout
|
||||
|
||||
- name: assert run stdin test
|
||||
assert:
|
||||
that:
|
||||
- cmdout|changed
|
||||
- cmdout.rc == 0
|
||||
- cmdout.stdout_lines|count == 1
|
||||
- cmdout.stdout_lines[0] == "some input"
|
||||
- cmdout.stderr == ""
|
||||
|
|
|
@ -188,3 +188,17 @@
|
|||
- shellout.stdout is search("doneout")
|
||||
- shellout.stderr is search("starterror")
|
||||
- shellout.stderr is search("doneerror")
|
||||
|
||||
- name: run stdin test
|
||||
win_shell: '$string = [Console]::In.ReadToEnd(); Write-Output $string.Trim()'
|
||||
args:
|
||||
stdin: some input
|
||||
register: shellout
|
||||
|
||||
- name: assert run stdin test
|
||||
assert:
|
||||
that:
|
||||
- shellout|changed
|
||||
- shellout.rc == 0
|
||||
- shellout.stderr == ""
|
||||
- shellout.stdout == "some input\r\n"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue