fix: clean agent bash lint

This commit is contained in:
Peter Steinberger
2025-12-25 03:29:36 +01:00
parent 2442186a31
commit 92f467e81c
5 changed files with 90 additions and 48 deletions

View File

@@ -11,9 +11,20 @@ export function getShellConfig(): { shell: string; args: string[] } {
}
export function sanitizeBinaryOutput(text: string): string {
return text
.replace(/[\p{Format}\p{Surrogate}]/gu, "")
.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, "");
const scrubbed = text.replace(/[\p{Format}\p{Surrogate}]/gu, "");
if (!scrubbed) return scrubbed;
const chunks: string[] = [];
for (const char of scrubbed) {
const code = char.codePointAt(0);
if (code == null) continue;
if (code === 0x09 || code === 0x0a || code === 0x0d) {
chunks.push(char);
continue;
}
if (code < 0x20) continue;
chunks.push(char);
}
return chunks.join("");
}
export function killProcessTree(pid: number): void {