Skip to content

Commit 20af421

Browse files
committed
fix: strip Wrangler color codes safely
1 parent 93344ff commit 20af421

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

scripts/setup.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ export function parseEnvironment(contents) {
128128
}
129129

130130
export function lifecycleRuleStatus(output, ruleId, prefix, retentionDays) {
131-
const plain = output.replace(/\u001B\[[0-9;]*m/g, "");
131+
const ansiPattern = new RegExp(`${String.fromCodePoint(27)}\\[[0-9;]*m`, "g");
132+
const plain = output.replace(ansiPattern, "");
132133
const block = plain
133134
.split(/\n\s*\n/)
134135
.find((candidate) => candidate.includes(`name: ${ruleId}\n`));

0 commit comments

Comments
 (0)