fusesource / jansi

Jansi is a small java library that allows you to use ANSI escape sequences to format your console output which works even on windows.
http://fusesource.github.io/jansi/
Apache License 2.0
1.12k stars 139 forks source link

Strip escapes when TERM=dumb #205

Closed fgunbin closed 3 years ago

fgunbin commented 3 years ago

I've got this use case: in emacs, I do M-x compile RET mvn clean install RET (Maven 3.6.3; macOS Terminal), and escapes are output (and not understood as colors).

Besides jansi system properties like jansi.mode=strip, there is also a workaround on the emacs side: C-u M-x compile .., which enables "comint" mode in compilation buffer, in which there's a filter function available, "ansi-color-process-output", which can filter or fontify escape sequences.

Emacs uses a tty for interactions with a subprocess (falling back to pipes only if tty is not available), so isatty check inside jansi won't help.

Also Emacs sets env var of this form: "INSIDE_EMACS=28.0.50,compile", but this is too emacs-specific.

Based on all this, it looks to me that jansi should check for TERM=dumb, and force "strip" mode in that case.

fgunbin commented 3 years ago

Ping?

fgunbin commented 3 years ago

@gnodet Thank you!