()
| 279 | } |
| 280 | |
| 281 | export async function finalizePendingAsyncHooks(): Promise<void> { |
| 282 | const hooks = Array.from(pendingHooks.values()) |
| 283 | await Promise.all( |
| 284 | hooks.map(async hook => { |
| 285 | if (hook.shellCommand?.status === 'completed') { |
| 286 | const result = await hook.shellCommand.result |
| 287 | await finalizeHook( |
| 288 | hook, |
| 289 | result.code, |
| 290 | result.code === 0 ? 'success' : 'error', |
| 291 | ) |
| 292 | } else { |
| 293 | if (hook.shellCommand && hook.shellCommand.status !== 'killed') { |
| 294 | hook.shellCommand.kill() |
| 295 | } |
| 296 | await finalizeHook(hook, 1, 'cancelled') |
| 297 | } |
| 298 | }), |
| 299 | ) |
| 300 | pendingHooks.clear() |
| 301 | } |
| 302 | |
| 303 | // Test utility function to clear all hooks |
| 304 | export function clearAllAsyncHooks(): void { |
no test coverage detected