progressCanAnimate function

bool progressCanAnimate()

Whether progress lines may animate.

stdout.hasTerminal alone — which is what mason_logger uses — is the answer for a program whose only reader is a terminal or a log file. It is the wrong one under revali up: the child's stdout is a pipe, so it says no, and the pane on the other end of that pipe is left redrawing a frame that never changes.

So it is either — a terminal of our own, or ansiForcedByParent, the handshake in which the parent says it is rendering this output the way a terminal would. Neither, and nothing moves: that case is CI, where a log full of frames is a regression.

Note the two questions are kept apart on purpose: TickedProgress takes animate separately from whether it emits ANSI, so forcing animation onto a pipe does not also force escape codes onto one. What a frame is dressed in is ansiOutputEnabled's answer, which runRevali sets from this same handshake — one signal, still two decisions.

Implementation

bool progressCanAnimate() => canAnimateProgress(
  hasTerminal: io.stdout.hasTerminal,
  forcedAnsi: ansiForcedByParent(),
);