Powershell script hangs

Still need help?

The Atlassian Community is here for you.

Ask the community

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

  1. 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
  2. If directly calling Powershell script from Bamboo, use Script task with 'Run as Powersell script option on'. Bamboo script task can handle this situation.
  3. 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
Last modified on Dec 18, 2015

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.