Skip to content

Commit 28b81b8

Browse files
authored
Merge pull request #2976 from chinesepowered/fix/hook-signal-exit-code
fix(hooks): preserve null exit code from signal kills instead of collapsing to 0
2 parents 4d4af4a + 6763035 commit 28b81b8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/core/src/hooks/hookRunner.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,15 +420,19 @@ export class HookRunner {
420420
}
421421
}
422422

423+
const killedBySignal = exitCode === null;
423424
resolve({
424425
hookConfig,
425426
eventName,
426427
success: exitCode === EXIT_CODE_SUCCESS,
427428
output,
428429
stdout,
429430
stderr,
430-
exitCode: exitCode || EXIT_CODE_SUCCESS,
431+
exitCode: exitCode ?? -1,
431432
duration,
433+
...(killedBySignal && {
434+
error: new Error('Hook killed by signal'),
435+
}),
432436
});
433437
});
434438

0 commit comments

Comments
 (0)