MCPcopy
hub / github.com/bombshell-dev/clack / registerHooks

Function registerHooks

packages/prompts/src/spinner.ts:77–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

75 const signalEventHandler = () => handleExit(1);
76
77 const registerHooks = () => {
78 // Reference: https://nodejs.org/api/process.html#event-uncaughtexception
79 process.on('uncaughtExceptionMonitor', errorEventHandler);
80 // Reference: https://nodejs.org/api/process.html#event-unhandledrejection
81 process.on('unhandledRejection', errorEventHandler);
82 // Reference Signal Events: https://nodejs.org/api/process.html#signal-events
83 process.on('SIGINT', signalEventHandler);
84 process.on('SIGTERM', signalEventHandler);
85 process.on('exit', handleExit);
86
87 if (signal) {
88 signal.addEventListener('abort', signalEventHandler);
89 }
90 };
91
92 const clearHooks = () => {
93 process.removeListener('uncaughtExceptionMonitor', errorEventHandler);

Callers 1

startFunction · 0.85

Calls 1

onMethod · 0.80

Tested by

no test coverage detected