Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/hooks/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,15 @@ export class HookEngine {
}
);

try {
child.stdin?.write(JSON.stringify(input));
child.stdin?.end();
} catch {
// EPIPE from a handler that never reads stdin — fine, decision comes
// from its exit code / stdout.
}
child.stdin?.on('error', err => {
// EPIPE from a handler that exits before reading stdin is fine; the
// decision still comes from exit code / stdout.
if ((err as NodeJS.ErrnoException).code !== 'EPIPE') {
logger.warn(`[hooks] ${path.basename(hook.sourceFile)} stdin write failed open: ${err.message.slice(0, 160)}`);
}
});
child.stdin?.write(JSON.stringify(input));
child.stdin?.end();
});
}
}
Expand Down
Loading