PowerShell immediate echo output

anatoly techtonik's Avatar

anatoly techtonik

21 Oct, 2016 10:20 AM

Hi,

I must admit I am not proficient in PowerShell, so it is hard to tell if it is AppVeyor bug or PowerShell that echo output is cached? For the following code the echo output is buffered until the whole block is executed. Is it intended and how to avoid that?

after_test:
- ps: |-
    # powershell capture command output into variable
    $version = lxc version
    echo $version
     # pack lxc as aftifact for upload
     $archive = "lxc-$version-windows-amd64.zip"
     7z a $archive c:\gopath\bin\lxc.exe

Output: https://ci.appveyor.com/project/lxc/lxd/build/master.189#L112

  1. 1 Posted by Ilya Finkelshte... on 21 Oct, 2016 04:39 PM

    Ilya Finkelshteyn's Avatar

    Hi Anatoly,

    This is mostly just looks this way, because appveyor first displays whole script it is planing to execute, but actually echo output is really displayed right after command executed. If you want more sequential look, do it not as a script block, but as a separate commands like this:

    after_test:
    # powershell capture command output into variable
    - ps: $version = lxc version
    - ps: echo $version
    # pack lxc as aftifact for upload
    - ps: $archive = "lxc-$version-windows-amd64.zip"
    - 7z a $archive c:\gopath\bin\lxc.exe
    

    Thank you,
    Ilya.

  2. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:09 AM.

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