ansiForcedByParent function

bool ansiForcedByParent([
  1. Map<String, String>? environment
])

Whether the parent asked this process to dress its output for a terminal.

The child half of the handshake, read in one place so the things that depend on it cannot come to disagree: runRevali and runConstruct turn mason_logger's colour on, and progressCanAnimate lets a progress line animate. They stay separate questions — a caller may animate onto a pipe without emitting colour, and the pane is why: it redraws frames in place whether or not they are coloured — but they are asked of the same signal, because the signal is one statement: something is rendering my output as a terminal would.

There are two entrypoints and not one because revali dev is two programs: the revali CLI, and the constructs entrypoint it starts with Isolate.spawnUri. Read from the environment rather than passed down, and that is what makes the second one possible — an environment is process-wide, so it crosses an isolate boundary that a zone value does not.

environment exists for tests. Anything real should let it default.

Implementation

bool ansiForcedByParent([Map<String, String>? environment]) =>
    (environment ?? io.Platform.environment)[kForceAnsiEnvVar] == '1';