Hi, I currently I am running a few git commands via the cut and paste powershell feature. I noticed that git is outputting to the powershell stderr stream? It looks like an error to powershell. Is that enough to halt the script?
I can run the script in the powershell ISE and see the red “errors” but it just continues and does the work as expected.
To test if the script can run successfully in Octopus you can tell Octopus to ignore any messages written to the error stream, to do this you would put the following at the top of your custom PowerShell script: Write-Host "##octopus[stderr-ignore]"
and then at the bottom of the script to turn normal error handling back on: Write-Host "##octopus[stderr-default]".
Because errors written to the error stream shouldn’t halt a script, they should output errors and fail the task that the script is running in.
I have cut and pasted the entire attached script into the powershell window for the step, and have included the suggested code. It
I have attached the log and the script, (dont feel you need to debug anything in there :D) You may note that I have the tags around the function calls, but I also had them at the top and bottom as suggested - same result.
OK, so i made sure the fingerprints were a-OK, and reduced my script down to the bare bones of a “hello world” type powershell script. I am postive that its the git command "git checkout that is writing the the strerr of powershell (expected) but even with the line Write-Host “##octopus[stderr-ignore]” in the script, it does not seem to be ignoring them
more info:
using the technique to suppress the stderr stream:
git checkout Release 2>&1 | write-host, is not honored in octopus, however it is when i run it in the terminal window.