Closed carpnick closed 9 years ago
Weird so debugging the WinRM gem:
Body Sent:
<env:Body>
<rsp:CommandLine>
<rsp:Command>" exit 100"</rsp:Command>
</rsp:CommandLine>
</env:Body>
Received:
<rsp:ReceiveResponse>
<rsp:CommandState CommandId='469786EF-ACB4-47D6-AC50-087F05B78CD4' State='http://schemas.microsoft.com/wbem/wsman/1/windows/shell/CommandState/Done'>
<rsp:ExitCode>0</rsp:ExitCode>
</rsp:CommandState>
</rsp:ReceiveResponse>
Request:
<env:Body>
<rsp:CommandLine>
<rsp:Command>"echo hello && exit 100"</rsp:Command>
</rsp:CommandLine>
</env:Body>
Response:
<s:Body>
<rsp:ReceiveResponse>
<rsp:Stream Name='stdout' CommandId='BD6AA971-D33B-48A8-A1BC-E2B515770A89'>aGVsbG8gDQo=</rsp:Stream>
<rsp:Stream Name='stdout' CommandId='BD6AA971-D33B-48A8-A1BC-E2B515770A89' End='true'/>
<rsp:Stream Name='stderr' CommandId='BD6AA971-D33B-48A8-A1BC-E2B515770A89' End='true'/>
<rsp:CommandState CommandId='BD6AA971-D33B-48A8-A1BC-E2B515770A89' State='http://schemas.microsoft.com/wbem/wsman/1/windows/shell/CommandState/Done'>
<rsp:ExitCode>100</rsp:ExitCode>
</rsp:CommandState>
</rsp:ReceiveResponse>
</s:Body>
Closing as this can be validated within only WinRM in the mix. See issue https://github.com/WinRb/WinRM/issues/154 for updates
If no output is returned in the winrm command, it always succeeds.
More than likely is a WinRM gem issue but opening here so others are not surprised. While debugging issue #311 , I found that this code(taken partially from winrm_session always has a success (0) exit code. If you comment out line 16 and uncomment line 17 it exits with the appropriate exit code (100)