Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only set CanColorStdout / CanColorStderr to true if the stdout/stderr is a terminal #19581

Merged
merged 3 commits into from
May 3, 2022

Conversation

wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented May 2, 2022

When running gitea as a systemd unit with logging set to console, the output should not be colorized,
otherwise it spams the journal / syslog with escape sequences like #033[0m#033[32mcmd/web.go:102:#033[32m

This PR adds IsTerminal checks for non-WIndows platforms. For Windows, it was already done correctly in console_window.go

Close #19469

@wxiaoguang wxiaoguang added the type/enhancement An improvement of existing functionality label May 2, 2022
@wxiaoguang wxiaoguang added this to the 1.17.0 milestone May 2, 2022
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label May 3, 2022
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 3, 2022
@6543
Copy link
Member

6543 commented May 3, 2022

🚀

@6543 6543 merged commit 730420b into go-gitea:main May 3, 2022
@wxiaoguang wxiaoguang deleted the fix-console-color branch May 3, 2022 16:03
zjjhot added a commit to zjjhot/gitea that referenced this pull request May 4, 2022
* giteaofficial/main:
  Fix broken TR on cherrypick page (go-gitea#19599)
  Use correct context in `routers/web` (go-gitea#19597)
  Use for a repo action one database transaction (go-gitea#19576)
  Only set CanColorStdout / CanColorStderr to true if the stdout/stderr is a terminal (go-gitea#19581)
  Don't fetch Mirror when it's migrating (go-gitea#19588)
  Move user password verification after checking his groups on ldap auth (go-gitea#19587)
AbdulrhmnGhanem pushed a commit to kitspace/gitea that referenced this pull request Aug 24, 2022
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement IsTerminal() to set initial CanColorStdout / CanColorStderr in console.go
5 participants