theory / tap-parser-sourcehandler-pgtap

TAP::Parser::SourceHandler::pgTAP
http://search.cpan.org/dist/TAP::Parser::SourceHandler::pgTAP
11 stars 13 forks source link

pg_prove --color doesn't always output colors #23

Closed dorian-marchal closed 2 years ago

dorian-marchal commented 5 years ago

When I pipe pg_prove (for example in cat), colors are stripped.

I expected the --color flag to force color output (in the same way as ls --color | cat, for example).

Is there a way to force pg_prove to ouput colors?

My use case is executing pg_prove from node:

# Output color:
pg_prove --color /etc/passwd

# Doesn't output color:
pg_prove --color /etc/passwd | cat

# Doesn't output color:
node -e 'require("child_process").exec("pg_prove --color /etc/passwd", (err, res) => console.log(res));'
theory commented 3 years ago

pg_prove relies on App::Prove for this, and it looks like it should force it if you specify it.