fix: avoid Windows runner unicode crash (#567)
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user