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:
Paul Bakaus
2026-08-31 19:56:22 -07:00
parent d1135b9764
commit d58ef7ab5c
7 changed files with 12 additions and 8 deletions
+6 -2
View File
@@ -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 };
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long