fix: avoid Windows runner unicode crash (#567)

This commit is contained in:
Peter Steinberger
2026-01-09 14:36:02 +01:00
parent 63f5fa47de
commit 760e9b3df5
2 changed files with 9 additions and 4 deletions

View File

@@ -1212,7 +1212,6 @@ export type AgentDefaultsConfig = {
| "msteams" | "msteams"
| "signal" | "signal"
| "imessage" | "imessage"
| "msteams"
| "none"; | "none";
/** Optional delivery override (E.164 for WhatsApp, chat id for Telegram). */ /** Optional delivery override (E.164 for WhatsApp, chat id for Telegram). */
to?: string; to?: string;

View File

@@ -503,13 +503,19 @@ function formatConsoleLine(opts: {
} }
function writeConsoleLine(level: Level, line: string) { function writeConsoleLine(level: Level, line: string) {
const sanitized =
process.platform === "win32" && process.env.GITHUB_ACTIONS === "true"
? line
.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, "?")
.replace(/[\uD800-\uDFFF]/g, "?")
: line;
const sink = rawConsole ?? console; const sink = rawConsole ?? console;
if (forceConsoleToStderr || level === "error" || level === "fatal") { if (forceConsoleToStderr || level === "error" || level === "fatal") {
(sink.error ?? console.error)(line); (sink.error ?? console.error)(sanitized);
} else if (level === "warn") { } else if (level === "warn") {
(sink.warn ?? console.warn)(line); (sink.warn ?? console.warn)(sanitized);
} else { } else {
(sink.log ?? console.log)(line); (sink.log ?? console.log)(sanitized);
} }
} }