mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-15 15:46:30 +03:00
detect: set process.exitCode instead of exiting after the final write
process.exit() right after a large piped stdout write truncated JSON output at the pipe buffer boundary; found by the oracle harness. Re-record the six directory-scan goldens that had captured the truncation. Prepared with AI assistance (Claude Code).
This commit is contained in:
@@ -423,10 +423,14 @@ async function detectCli() {
|
||||
}
|
||||
}
|
||||
else process.stderr.write(formatFindings(allFindings, false) + '\n');
|
||||
process.exit(primary.length > 0 ? 2 : 0);
|
||||
// Set the exit code instead of calling process.exit(): a piped stdout is
|
||||
// written asynchronously, and exiting right after a large write truncates
|
||||
// the JSON at the pipe buffer boundary (~64 KiB).
|
||||
process.exitCode = primary.length > 0 ? 2 : 0;
|
||||
return;
|
||||
}
|
||||
if (jsonMode) process.stdout.write('[]\n');
|
||||
process.exit(0);
|
||||
process.exitCode = 0;
|
||||
}
|
||||
|
||||
export { formatFindings, handleStdin, confirm, printUsage, detectCli };
|
||||
|
||||
Reference in New Issue
Block a user