PowerShell scripts best-practice
I am switching my build from non-appveyor.yml + cmd to appveyor.yml + powershell.
Previously, when a command-line program failed, the whole build stopped.
But now, using PowerShell, I'm finding that Powershell seems to "eat" the failures and not pass them on to AppVeyor. So AppVeyor reports build success, even though a command-line tool failed.
What is the best way to (a) format powershell scripts that execute command-line programs, and (b) call those ps1 scripts from AppVeyor so that failed builds are reported properly?
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Owen McDonnell on 15 Nov, 2018 07:22 PM
In answer to the first question (a), it depends on what you are calling. If it is in the environment path variable, you should be able to call it directly, if not, you may need to use the call operator (&) to access the directory. Here is a useful summary.
For the second question, the
$ErrorActionPreference
variable is set tocontinue
by default, but you can set it to$ErrorActionPreference = Stop
at the beginning of a script.Ilya Finkelshteyn closed this discussion on 15 Jan, 2019 09:00 PM.