Fix JSON output contamination in test runner

Change judge.ts progress message from console.log (stdout) to
process.stderr.write (stderr) to prevent 'Judging batch...' message
from contaminating JSON output when using --output json flag.
This commit is contained in:
Shang Chieh Tseng
2025-12-17 16:08:01 +08:00
parent e06deff40f
commit b0c2a07190

View File

@@ -98,8 +98,9 @@ Respond ONLY with the JSON array, no other text.`;
// Process in batches
for (let i = 0; i < results.length; i += this.batchSize) {
const batch = results.slice(i, i + this.batchSize);
console.log(
` Judging batch ${Math.floor(i / this.batchSize) + 1}/${Math.ceil(results.length / this.batchSize)}...`,
// Write progress to stderr to avoid contaminating JSON output on stdout
process.stderr.write(
` Judging batch ${Math.floor(i / this.batchSize) + 1}/${Math.ceil(results.length / this.batchSize)}...\n`,
);
try {