Skip to content

Capturing output from programs in bash shell doesn't work #27131

Discussion options

You must be logged in to vote

I guess that for some reason (e.g. different version, platform, or build options) the lcov version on the runner writes to stderr instead of stdout, so the regular pipe doesn’t capture the output.

The easiest solution should be to use |& to capture both stdout and stderr:

    run: |
      lines=`lcov --summary coverage.info |& grep -Eo ' [0-9.]+%' | xargs | awk '{print $1}' || echo 'error'`
      echo "lines = ${lines}"

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@ervanipank05
Comment options

Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants