Skip to content

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

@FrzMtrsprt

Description

@FrzMtrsprt

如下图,如果想在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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions