Octopus step with script hangs after success

Hi.
I have this octopus step that runs a powershell script which runs Protractor. After the powershell script is complete (and protractor has run successfully), the step just hangs. Even if Protractor finished with success. But if I change the script to just run “protractor --version”, then the step succeed and continue. So it seems to be something related to what happens during the protractor run. I can run the same script manually on the octopus server without any issues.

Hi,

Thanks for getting in touch.

Protractor might be hanging on to an output stream that is preventing the script step from finishing. You could try enclosing the call in brackets, for example: (protractor ....) or using Start-Process protractor.

If neither of those work we may need a process dump of the Tentacle so we can determine what it is waiting for (https://octopus.com/docs/reference/process-dumps#creating-a-process-dump).

Please let me know if this helps.

Cheers,
Shane

Thank you. Using Start-Process solved the issue. But is there a way to manually fail a step? I can get the exit code from start-process, so I need to manually fail if it’s different to 0.

Hi,

Yes, you can fail a PowerShell step by exiting with a non-zero exit code. For example:

Exit 1

You will probably just want to exit with the code you get back from Start-Process.

Cheers,
Shane