Better error handling
This commit is contained in:
parent
0593c0def7
commit
aa2d38d6c1
|
|
@ -27,14 +27,19 @@ $remoteScript = {
|
||||||
cd C:\$using:serverFolder\$using:projectName
|
cd C:\$using:serverFolder\$using:projectName
|
||||||
dir
|
dir
|
||||||
$env:DNX_TRACE=1
|
$env:DNX_TRACE=1
|
||||||
$testResult = & .\test.cmd 2>&1
|
|
||||||
$testResult = & $lastexitcode
|
$output = & .\test.cmd 2>&1
|
||||||
|
$output
|
||||||
|
$lastexitcode
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host ">>>> Remote code execution started <<<<"
|
Write-Host ">>>> Remote code execution started <<<<"
|
||||||
$result = Invoke-Command -ComputerName $server -Credential $cred -ScriptBlock $remoteScript
|
$remoteJob = Invoke-Command -ComputerName $server -Credential $cred -ScriptBlock $remoteScript -AsJob
|
||||||
$result
|
Wait-Job $remoteJob
|
||||||
Write-Host "<<<< Remote execution code completed >>>>"
|
Write-Host "<<<< Remote execution code completed >>>>"
|
||||||
|
|
||||||
$testExitCode = $result[$result.length-1];
|
$remoteResult = Receive-Job $remoteJob
|
||||||
exit $testExitCode
|
$remoteResult
|
||||||
|
|
||||||
|
$finalExitCode = $remoteResult[$remoteResult.Length-1]
|
||||||
|
exit $finalExitCode
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue