Powershell script hangs
Symptoms
Powershell scripts doesn't return control to Bamboo, build hangs forever.
Cause
Bamboo expect child process to close its output stream (stdout and stderr) when exiting. Powershell doesn't do it.
Resolution
If you're creating an executable for Powershell and running it via a Command task, add a '
-inputformat none'
to the command argument. The command argument field should look like this:-inputformat none -command
- If directly calling Powershell script from Bamboo, use Script task with 'Run as Powersell script option on'. Bamboo script task can handle this situation.
If Powershell is called indirectly (e.g. from ant, nant, maven, other script), make sure that the streams are closed on exit:
powershell .\test.ps1 < NUL