Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

fix(test): hive-hook-node races its own stdin write and fails on EPIPE

lavadman74a3917e0345
diff --git a/test/hive-hook-node.test.cjs b/test/hive-hook-node.test.cjs
index d68e3564..eed87bba 100644
--- a/test/hive-hook-node.test.cjs
+++ b/test/hive-hook-node.test.cjs
@@ -68,6 +68,12 @@ async function run(cmd, env) {
const child = spawn('/bin/sh', ['-c', cmd], { env, stdio: ['pipe', 'pipe', 'pipe'] });
let stderr = '';
child.stderr.on('data', (d) => { stderr += d; });
+ // These commands are EXPECTED to exit before the payload lands — the control
+ // case below asserts `node "<shim>"` exits 127 under a stripped PATH. A child
+ // that is already gone makes this write EPIPE, and an unhandled 'error' on
+ // stdin rejects the test rather than the command under test failing. The exit
+ // code is what this helper reports, so a lost write is not a lost signal.
+ child.stdin.on('error', () => { /* child exited before reading stdin */ });
child.stdin.end(JSON.stringify({ hook_event_name: 'Stop', session_id: 's1' }));
child.on('close', (code) => resolve({ code, stderr }));
});