Skip to content

fix(compile): enable ANSI colors on Windows in compiled binaries#34701

Merged
bartlomieju merged 1 commit into
mainfrom
fix/compile-windows-ansi-colors
Jun 2, 2026
Merged

fix(compile): enable ANSI colors on Windows in compiled binaries#34701
bartlomieju merged 1 commit into
mainfrom
fix/compile-windows-ansi-colors

Conversation

@bartlomieju

Copy link
Copy Markdown
Member

Fixes #29875.

Since Deno 2.2.6, deno compile'd executables print raw ANSI escape codes
instead of colored output on Windows consoles that do not enable virtual
terminal processing by default, such as Windows Server 2022 and the classic
conhost. deno run is unaffected.

The cause is that a compiled binary does not run the normal deno
entrypoint. It embeds the denort runtime in cli/rt, which has its own
main(). The main deno binary enables ANSI on Windows via
colors::enable_ansi() (in cli/lib.rs), but denort's main() never did,
so the console was never switched into virtual terminal mode and treated the
escape sequences literally. The new Windows Terminal enables VT processing
itself, which is why the regression only shows on older or server consoles.

This mirrors the colors::enable_ansi() call into denort's main() behind
#[cfg(windows)], matching what the main binary already does.

Note: this is Windows console behavior and cannot be reproduced on macOS or
Linux, so it should be validated on a Windows Server / non Windows Terminal
console before merge.

`deno compile` embeds the denort runtime (cli/rt), whose main() did not
enable ANSI virtual terminal processing on Windows, unlike the main deno
binary. On consoles that don't enable it by default (Windows Server 2022,
classic conhost) compiled executables printed raw ANSI escape codes
instead of colored output, while `deno run` worked. Mirror the
`colors::enable_ansi()` call from the main entrypoint.

Closes #29875
@bartlomieju
bartlomieju merged commit 214f3d1 into main Jun 2, 2026
136 checks passed
@bartlomieju
bartlomieju deleted the fix/compile-windows-ansi-colors branch June 2, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect ANSI control code output on console.log when using deno compile

1 participant