nextest icon indicating copy to clipboard operation
nextest copied to clipboard

Figuring out how to fully get colors out of Miri

Open saethlin opened this issue 2 years ago • 6 comments

Miri emits colorful diagnostics only if it is connected to a TTY (we have had a bad time trying to implement --color=always). Since nextest launches tests in subprocesses and manages them, the Miri process always thinks it isn't connected to a TTY, and doesn't emit colors.

Is this fixable?


For my own purposes I would be fine with setting a config option to have nextest always convince subprocesses that they are connected to a TTY but maybe that's unique

saethlin avatar Jan 04 '23 21:01 saethlin

Hmm, is supporting CARGO_TERM_COLOR, or one of the other semi-standard variables like CLICOLOR_FORCE, out of the question? I'd prefer it be handled through environment variables rather than trying to do some sort of PTY thing.

You can also use --no-capture which passes through stdout/stderr from the parent process. Note that stdin is always closed -- in the past there have been situations where tests have tried to read from stdin to their detriment.

sunshowers avatar Jan 04 '23 22:01 sunshowers

Well, nothing is out of the question.

--no-capture does produce colors which is good but it looks like this is the equivalent of --nocapture which is not so great. A lot of crates write incredible amounts of data to stdout/stderr, and I would prefer to not persist all of that.

I'll look into what exactly CARGO_TERM_COLOR does and reply later.

saethlin avatar Jan 05 '23 00:01 saethlin

I think CARGO_TERM_COLOR doesn't work with cargo-miri because cargo-miri isn't actually Cargo. Argh, maybe this is a good reason to straighten out that whole situation.

saethlin avatar Feb 11 '23 20:02 saethlin

Thanks for looking into this, hah. I think cargo plugins should generally respect that env var (nextest does so)

sunshowers avatar Feb 11 '23 20:02 sunshowers