Robocopy will exit with code above 0 and may not fail. PSake detects anything above 0 as a failure and does not complete the build. This is normal, but why it still fails:
task Deploy { robocopy $source $dest /NP /S /XO /NFL /NDL /NJH /NJS | Out-Default if ($lastexitcode -eq 3) { Write-Host "Got Here" $lastexitcode = 0 } Write-Host "Deploy local complete" Write-Host $lastexitcode } TaskTearDown { if ($LastExitCode -ne 0) { write-host "Build failed" exit 1 } }
I can verify that the Deploy if statement hit and Write-Host returns 0, correctly, but TaskTearDown still detects the last exit code as 3! How to fix it?
chum of chance
source share