Returning non-zero exit code on build failure is done in psake.cmd instead of in Invoke-Psake #21

Merged
merged 1 commit into from Oct 4, 2011

Projects

None yet

3 participants

@whut
psake member

Hi,

I had randomly appearing problem with psake freezing after build failure. After some investigation I found it was because of IsChildOfService function that tried to find parent process and check if it is Windows Service. Unfortunately Windows is not Unix;), and ParentProcessId can point to terminated or completely different process. Probably because that I rarely turn my computer off, sometimes ParentProcessId pointed to some process that point to process that point again to first process, so it caused infinite loop.

Now Invoke-Psake instead of voo-doo to find if it is Windows Service, doesn't do anything special, just sets $psake.build_success, and setting exit code is done in psake.ps1. By the way this also fixed our problem with inability to run psake more than once in one build server run (at least in Hudson).

@whut whut Returning non-zero exit code on build failure is done in psake.cmd in…
…stead of in Invoke-Psake

Now Invoke-Psake newer exits whole PowerShell process, so it is possible to run psake more than once in one build server run.
Also it fixes problem with random freezes on errors. They happened because psake tried to find out if it is called by windows service and used ParentProcessId,
but Windows is not Unix;), and this Id can point to terminated or completely different process, and such process can again point to first process, and it causes infinite loops.

Also formatting changes in psake.ps1, now is the same formatting style as in psake.psm1
d185d23
@lanwin
psake member

Nice. Did that also solve the problem that you can not run psake after a ctrl+c again?

@whut whut merged commit d185d23 into psake:master Oct 4, 2011
@jmatos
psake member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment