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

[Feature Request] 支持输出不带ANSI转义序列的纯文本日志 #791

Closed
FrzMtrsprt opened this issue Jul 20, 2022 · 1 comment · Fixed by #798
Closed

[Feature Request] 支持输出不带ANSI转义序列的纯文本日志 #791

FrzMtrsprt opened this issue Jul 20, 2022 · 1 comment · Fixed by #798
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@FrzMtrsprt
Copy link
Contributor

如下图,如果想在Qt应用中显示运行日志的话,使用QProcess读到的运行日志是带有ANSI转义符的,输出到文本框后就会看起来一团糟。
同样,将运行日志输出至文件(例如unblockneteasemusic-win-x64.exe > log.txt)时,输出的日志仍然带有ANSI转义符。

是否能像GCC一样,在输出到非TTY设备时,输出未经ANSI转义的纯文本?

详见:Color output in console - ArchWiki

When you run a command and pipe its standard output (stdout) to less for a paged view (e.g. pacman -Qe | less), you may find that the output is no longer colored. This is usually because the program tries to detect if its stdout is an interactive terminal, in which case it prints colored text, and otherwise prints uncolored text. This is good behaviour when you want to redirect stdout to a file, e.g. pacman -Qe > pkglst-backup.txt, but less suited when you want to view output in less.

test_NpcqiZUiL5

@redn3ck
Copy link

redn3ck commented Jul 21, 2022

你这个output并不是一团糟,只是win的语法高亮,你这里不显示而已吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants