mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-03-30 13:43:26 +08:00
fix: exact byte pass-through in post-edit-console-warn, add 7 tests
Replace console.log(data) with process.stdout.write(data) in both pass-through paths to prevent appending a trailing newline that corrupts the hook output. Add 7 tests covering exact byte fidelity, malformed JSON, missing file_path, non-existent files, exclusion patterns in check-console-log, non-git repo handling, and empty stdin.
This commit is contained in:
@@ -28,7 +28,7 @@ process.stdin.on('end', () => {
|
||||
|
||||
if (filePath && /\.(ts|tsx|js|jsx)$/.test(filePath)) {
|
||||
const content = readFile(filePath);
|
||||
if (!content) { console.log(data); return; }
|
||||
if (!content) { process.stdout.write(data); return; }
|
||||
const lines = content.split('\n');
|
||||
const matches = [];
|
||||
|
||||
@@ -48,5 +48,5 @@ process.stdin.on('end', () => {
|
||||
// Invalid input — pass through
|
||||
}
|
||||
|
||||
console.log(data);
|
||||
process.stdout.write(data);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user