repro: add even more logging to HookRunner and TestRig

This commit is contained in:
Taylor Mullen
2026-02-10 09:36:34 -08:00
parent 0c04bc4cf6
commit 9b4e3e7c53
3 changed files with 19 additions and 2 deletions
+4 -1
View File
@@ -100,7 +100,10 @@ describe('Hooks System Integration', () => {
const scriptPath = rig.createScript(
'stderr_block_hook.cjs',
"process.stderr.write('File writing blocked by security policy'); process.exit(2);",
`
process.stderr.write('File writing blocked by security policy');
process.exit(2);
`,
);
const normalizedCmd = normalizePath(`node "${scriptPath}"`);
+10
View File
@@ -339,6 +339,12 @@ export class HookRunner {
stderr += data.toString();
});
child.on('exit', (code, signal) => {
if (process.env['CI'] === 'true' || process.env['VERBOSE'] === 'true') {
console.log(`[HookRunner] Hook exit. code: ${code}, signal: ${signal}`);
}
});
// Handle process exit
child.on('close', (exitCode) => {
clearTimeout(timeoutHandle);
@@ -406,6 +412,10 @@ export class HookRunner {
clearTimeout(timeoutHandle);
const duration = Date.now() - startTime;
if (process.env['CI'] === 'true' || process.env['VERBOSE'] === 'true') {
console.log(`[HookRunner] Hook process error: ${error.message}`);
}
resolve({
hookConfig,
eventName,
+5 -1
View File
@@ -65,7 +65,11 @@ export function sanitizeTestName(name: string) {
* On Windows, this converts backslashes to forward slashes.
*/
export function normalizePath(p: string): string {
return p.replace(/\\/g, '/');
const result = p.replace(/\\/g, '/');
if (process.env['CI'] === 'true' || process.env['VERBOSE'] === 'true') {
console.log(`[normalizePath] "${p}" -> "${result}"`);
}
return result;
}
// Helper to create detailed error messages