repro: always parse JSON from hook output regardless of exit code

This commit is contained in:
Taylor Mullen
2026-02-10 17:03:02 -08:00
parent 5369d6509b
commit 5b371082e3
2 changed files with 15 additions and 13 deletions
+6 -1
View File
@@ -97,9 +97,14 @@ describe('Hooks System Integration', () => {
);
const blockMsg = 'File writing blocked by security policy';
const blockJson = JSON.stringify({
decision: 'deny',
reason: blockMsg,
});
const scriptPath = rig.createScript(
'stderr_block_hook.cjs',
`process.stderr.write('${blockMsg}'); process.exit(2);`,
`process.stderr.write(JSON.stringify({ decision: 'deny', reason: '${blockMsg}' })); process.exit(2);`,
);
rig.setup(