ci: drop output sanitize wrapper
This commit is contained in:
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
|||||||
command: pnpm lint
|
command: pnpm lint
|
||||||
- runtime: node
|
- runtime: node
|
||||||
task: test
|
task: test
|
||||||
command: node scripts/ci-sanitize-output.mjs pnpm test
|
command: pnpm test
|
||||||
- runtime: node
|
- runtime: node
|
||||||
task: build
|
task: build
|
||||||
command: pnpm build
|
command: pnpm build
|
||||||
@@ -104,7 +104,7 @@ jobs:
|
|||||||
command: pnpm lint
|
command: pnpm lint
|
||||||
- runtime: node
|
- runtime: node
|
||||||
task: test
|
task: test
|
||||||
command: node scripts/ci-sanitize-output.mjs pnpm test
|
command: pnpm test
|
||||||
- runtime: node
|
- runtime: node
|
||||||
task: build
|
task: build
|
||||||
command: pnpm build
|
command: pnpm build
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
import { spawn } from "node:child_process";
|
|
||||||
|
|
||||||
function sanitizeBuffer(input) {
|
|
||||||
const out = Buffer.allocUnsafe(input.length);
|
|
||||||
for (let i = 0; i < input.length; i++) {
|
|
||||||
const b = input[i];
|
|
||||||
// Keep: tab/newline/carriage return + printable ASCII; replace everything else.
|
|
||||||
out[i] = b === 9 || b === 10 || b === 13 || (b >= 32 && b <= 126) ? b : 63;
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
const [command, ...args] = process.argv.slice(2);
|
|
||||||
if (!command) {
|
|
||||||
process.stderr.write(
|
|
||||||
"Usage: node scripts/ci-sanitize-output.mjs <cmd> [args...]\n",
|
|
||||||
);
|
|
||||||
process.exit(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
const child = spawn(command, args, {
|
|
||||||
stdio: ["ignore", "pipe", "pipe"],
|
|
||||||
shell: process.platform === "win32",
|
|
||||||
});
|
|
||||||
|
|
||||||
child.stdout.on("data", (chunk) => {
|
|
||||||
process.stdout.write(sanitizeBuffer(Buffer.from(chunk)));
|
|
||||||
});
|
|
||||||
|
|
||||||
child.stderr.on("data", (chunk) => {
|
|
||||||
process.stderr.write(sanitizeBuffer(Buffer.from(chunk)));
|
|
||||||
});
|
|
||||||
|
|
||||||
child.on("exit", (code, signal) => {
|
|
||||||
if (signal) process.exit(1);
|
|
||||||
process.exit(code ?? 1);
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user