windows command changed to use CreateProcess (#30253)

* windows command changed to use CreateProcess

* change to get become to work
This commit is contained in:
Jordan Borean 2017-09-14 02:58:49 +10:00 committed by Matt Davis
commit 6d196eaa98
6 changed files with 669 additions and 221 deletions

View file

@ -28,7 +28,7 @@
- not cmdout|changed
- cmdout.cmd == 'bogus_command1234'
- cmdout.rc == 2
- cmdout.msg is search('cannot find the file specified')
- "'Could not locate the following executable bogus_command1234' in cmdout.msg"
- name: execute something with error output
win_command: cmd /c "echo some output & echo some error 1>&2"
@ -134,3 +134,47 @@
- cmdout.stdout is search("doneout")
- cmdout.stderr is search("starterror")
- cmdout.stderr is search("doneerror")
- name: create testing folder for argv binary
win_file:
path: C:\ansible testing
state: directory
- name: download binary the outputs argv to stdout
win_get_url:
url: https://s3.amazonaws.com/ansible-ci-files/test/integration/roles/test_win_module_utils/PrintArgv.exe
dest: C:\ansible testing\PrintArgv.exe
- name: call argv binary with absolute path
win_command: '"C:\ansible testing\PrintArgv.exe" arg1 "arg 2" C:\path\arg "\"quoted arg\""'
register: cmdout
- name: assert call to argv binary with absolute path
assert:
that:
- cmdout|changed
- cmdout.rc == 0
- cmdout.stdout_lines[0] == 'arg1'
- cmdout.stdout_lines[1] == 'arg 2'
- cmdout.stdout_lines[2] == 'C:\\path\\arg'
- cmdout.stdout_lines[3] == '"quoted arg"'
- name: call argv binary with relative path
win_command: 'PrintArgv.exe C:\path\end\slash\ ADDLOCAL="msi,example" two\\slashes'
args:
chdir: C:\ansible testing
register: cmdout
- name: assert call to argv binary with relative path
assert:
that:
- cmdout|changed
- cmdout.rc == 0
- cmdout.stdout_lines[0] == 'C:\\path\\end\\slash\\'
- cmdout.stdout_lines[1] == 'ADDLOCAL=msi,example'
- cmdout.stdout_lines[2] == 'two\\\\slashes'
- name: remove testing folder
win_file:
path: C:\ansible testing
state: absent