Subject: [bug#29359] [PATCH 08/31] gnu: Add java-jansi.

From: Tobias Geerinckx-Rice <[email-masked]>
Date: Fri, 24 Nov 2017 16:31:20 +0100

Julien,

On Wed, Nov 22, 2017 at 10:33:56AM +0100, julien lepiller wrote:
> There's a small issue with this package: when it runs its tests, it
> will output formatted text with colors but forgets to clean the
> console afterwards, which leaves the console with a bold red font.> Any idea on how to clean that?

You could add a reset-terminal phase after the test phase that sends an
ANSI reset sequence. Either by invoking the ‘reset’ command, which would
add a dependency on ncurses and is probably overkill, or by sending
(from memory, so check) \e[0m which resets only colour and weight and is
probably all you need here.

> Shouldn't the environment block this kind of thing?

The problem is that the state modified by these escape sequences is in
the terminal itself.

We could filter build output through a sanitiser that strips or mangles
those sequences so we only print ‘plain text’ to the terminal (while
keeping them in logs — I'm sure some source-based package managers do
just that). I don't know if that would break some tests, though.

Kind regards,

T G-R