MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / shutdown

Function shutdown

src/index.ts:130–142  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

128 void mcpManager.startAll().catch(err => logger.warn(`MCP background startup error: ${err?.message ?? err}`));
129
130 // Graceful shutdown — also fires SessionEnd hooks
131 const shutdown = async (): Promise<void> => {
132 logger.info('Shutting down...');
133 try {
134 if (hooks.hasAny('SessionEnd')) {
135 await hooks.dispatch('SessionEnd', { event: 'SessionEnd', sessionId: 'shutdown', cwd: process.cwd() });
136 }
137 } catch (err) { logger.debug('SessionEnd hook failed', { err }); }
138 try {
139 const m = getMCPManager();
140 if (m) await m.stopAll();
141 } catch {}
142 process.exit(0);
143 };
144 process.once('SIGINT', shutdown);
145 process.once('SIGTERM', shutdown);

Callers

nothing calls this directly

Calls 6

getMCPManagerFunction · 0.85
infoMethod · 0.80
hasAnyMethod · 0.80
dispatchMethod · 0.80
debugMethod · 0.80
stopAllMethod · 0.80

Tested by

no test coverage detected