Better error handling

This commit is contained in:
Victor Hurdugaci 2015-05-11 16:31:44 -07:00
parent 0593c0def7
commit aa2d38d6c1
1 changed files with 11 additions and 6 deletions

View File

@ -27,14 +27,19 @@ $remoteScript = {
cd C:\$using:serverFolder\$using:projectName
dir
$env:DNX_TRACE=1
$testResult = & .\test.cmd 2>&1
$testResult = & $lastexitcode
$output = & .\test.cmd 2>&1
$output
$lastexitcode
}
Write-Host ">>>> Remote code execution started <<<<"
$result = Invoke-Command -ComputerName $server -Credential $cred -ScriptBlock $remoteScript
$result
$remoteJob = Invoke-Command -ComputerName $server -Credential $cred -ScriptBlock $remoteScript -AsJob
Wait-Job $remoteJob
Write-Host "<<<< Remote execution code completed >>>>"
$testExitCode = $result[$result.length-1];
exit $testExitCode
$remoteResult = Receive-Job $remoteJob
$remoteResult
$finalExitCode = $remoteResult[$remoteResult.Length-1]
exit $finalExitCode