Loosing colors when using powershell

oliver's Avatar

oliver

19 Mar, 2018 10:56 AM

Hi.

I would like to use the powershell to resolve what powershell version to use.
(As - ps: works in the ubuntu image and I dont have do diff between bash and batch)

- ps: if (([version]$env:PowershellVersion).Major -ge 6) {$env:posh = "pwsh"} else {$env:posh = "powershell"}

Ideally I would execute the build/test scripts like this:

- ps: & $env:posh -File "./Tools/setup.ps1"
but AppVeyor fails to parse the yml file. So I am doing this:
- ps: Write-Host ""; & $env:posh -File "./Tools/setup.ps1"
but by doing this, I loose the color coding of the console. See https://ci.appveyor.com/project/AtlassianPS/confluenceps/build/job/...
  1. 1 Posted by oliver on 20 Mar, 2018 06:16 PM

    oliver's Avatar

    bump

  2. Support Staff 2 Posted by wasapl on 20 Mar, 2018 08:19 PM

    wasapl's Avatar

    Oliver,
    there is a special meaning for ampersand in YAML https://en.wikipedia.org/wiki/YAML#Advanced_components
    That is why AppVeyor fails to parse it. Please quote your line:

    - ps: '& $env:posh -File "./Tools/setup.ps1"'
    
  3. Support Staff 3 Posted by Ilya Finkelshte... on 20 Mar, 2018 09:14 PM

    Ilya Finkelshteyn's Avatar

    PowerShell Core support is implemented differently on our Windows build agent than on Linux one, and it is colorless by design. We plan to merge those implementations later and it will support colors. Cannot say specific ETA though.

    Regarding YAML exceptions, I would add that I myself very often set configuration in UI and then use Export YAML to get working syntax.

  4. oliver closed this discussion on 21 Mar, 2018 02:43 PM.

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