mirror of
https://github.com/thedotmack/claude-mem
synced 2026-04-25 17:15:04 +02:00
On Linux, Bun's libuv calls fstat() on inherited pipe file descriptors and crashes with EINVAL when the pipe originates from Claude Code's hook system. This causes all PostToolUse hooks to fail silently, preventing observations from being recorded. The fix reads stdin entirely in the Node.js parent process (bun-runner.js) before spawning Bun, then writes the buffered data to a fresh pipe created by Node's child_process.spawn(). Bun receives a standard pipe that it can fstat() without errors. Changes: - Add collectStdin() to buffer piped input in Node.js with 5s safety timeout - Change stdio from 'inherit' to ['pipe'|'ignore', 'inherit', 'inherit'] - Write buffered stdin to child.stdin then close for proper EOF signaling - Handle edge cases: TTY stdin, no stdin, read errors Fixes #646 Co-authored-by: yczc3999 <zxfgds@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>