bug: heroku logs --force-colors flag ignored
heroku logs ignores the --force-colors argument when piped
Call:
heroku logs --force-colors -a my-app | cat
If bug, first try running
heroku updateand settingDEBUG=*to see extra debug information.
Done, nothing of interest besides the fact that the flag is clearly passed to the constructor:
heroku:logs init version: @oclif/[email protected] argv: [ '--force-colors', '-a', 'my-app' ] +0ms
What is the current behavior?
No colors
What is the expected behavior?
Colors, as they appear when you don't pipe it through anything.
node 10.16.0
heroku cli version : heroku/7.33.0 darwin-x64 node-v10.16.0
Installed latest stable using npm install heroku and used npx to double check.
This is easy to test.
Try heroku logs --tail --force-colors -a my-app > output.txt. Open output.txt in sublime text or any other text editor that shows escape codes. You would expect to see the ansi codes, but you do not.
Compare this with Pygments. Install Pygments with pip, then run the command pygmentize some_code.py > output.txt. some_code.py can be any code file. Open output.txt in sublime again and you will see the ansi codes. This is what we should see with heroku if --force-colors is on.
heroku init version: @oclif/[email protected] argv: [ 'logs', '--force-colors', '-a', 'my-app' ] +0ms
Issue still there
Awesome! Thank you! :pray: :slightly_smiling_face:
Can I check on the progress with this issue? The ticket linked above seems to be private.
@mgroth0 I apologize, we have a small team and haven't had a chance to look into this one yet.
This seems to still be an issue but as a workaround you should be able to force colour using the FORCE_COLOR environment variable instead. That overrides the colour setting in the underlying supports-color library instead 😄
This should be fixed on recent versions of Heroku CLI. Let us know if you still see the issue.