What is the difference between Powershell warnings and error preferences in production and debug mode?

kartikohri13's Avatar


10 Jun, 2020 12:58 PM

Some of the commands I execute during test phase produce output as INFO and NOTICE. Powershell flags this as an error and raises an exception during production mode but when I run the same commands in debug mode there is no error. I think there may be some difference in the error preferences. Can someone help me diagnose this ?

  1. Support Staff 1 Posted by Feodor Fitsner on 10 Jun, 2020 07:27 PM

    Feodor Fitsner's Avatar

    Could you drop a link to a build please?

  2. 2 Posted by kartikohri13 on 11 Jun, 2020 09:04 AM

    kartikohri13's Avatar

    Please see https://ci.appveyor.com/project/amCap1712/pljava/builds/33437118 .
    At the end of the build, Powershell fails the build with an exception
    raised due to debug output. This issue does not happen in debug builds.

  3. Support Staff 3 Posted by Feodor Fitsner on 11 Jun, 2020 08:52 PM

    Feodor Fitsner's Avatar

    It's how PowerShell custom host is working. Windows PowerShell treats all writes to StdErr as exceptions.

    To workaround that issue I'd move everything starting from ps: to a separate .ps1 scripts and then call them from appveyor.yml as:

    - powershell .\script.ps1

    ...or if psql command line has some "quiet" switch suppressing those messages that could work too.

    ...or you can use this great function (we use it while building images) to run process with right redirection or with suppressing StdErr: https://github.com/appveyor/build-images/blob/master/scripts/Window... Usage examples: https://github.com/appveyor/build-images/search?q=Start-ProcessWith...

  4. 4 Posted by kartikohri13 on 12 Jun, 2020 03:06 AM

    kartikohri13's Avatar

    Thanks for the help. Could you explain why merely moving commands from
    appveyor.yml to a .ps1 script can fixt his issue?

  5. Support Staff 5 Posted by Feodor Fitsner on 12 Jun, 2020 05:05 AM

    Feodor Fitsner's Avatar

    The whole point of that is redirecting StdErr to StdOut.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? 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

Recent Discussions

02 Jul, 2020 03:24 PM
01 Jul, 2020 08:32 PM
01 Jul, 2020 01:12 PM
30 Jun, 2020 04:26 PM
25 Jun, 2020 05:54 PM