heroku / cli

Heroku CLI
https://devcenter.heroku.com/articles/heroku-cli
ISC License
852 stars 223 forks source link

--json shows update messages #1736

Open brendanfalk opened 3 years ago

brendanfalk commented 3 years ago

Bug image

What is the current behavior?

When using the --json flag (such as in the example above) Heroku shows update messages.

What is the expected behavior?

It should not output update messages. Why? I would think that the vast majority of the time when someone uses --json they are intending to pipe the output into something like jq. However, when the update message is present, the output string is not valid json

fivetanley commented 3 years ago

Hi,

The Heroku CLI outputs should be outputting this warning on STDERR, not STDOUT. This allows us to display the error, while keeping something like heroku apps --all --json | jq . working. While it is a bit confusing, I think this is intended behaviour.

Have you noticed this breaking any scripts for you? It may be possible we're emitting a warning over stdout when we should be emitting over stderr

brendanfalk commented 3 years ago

Yes - we run that shell command in what I believe is a non-login process and it still outputs the warning... I can't reproduce anymore as I updated the CLI...