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.
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.