MCPcopy Index your code
hub / github.com/continuedev/continue / gracefulExit

Function gracefulExit

extensions/cli/src/util/exit.ts:193–220  ·  view source on GitHub ↗
(code: number = 0)

Source from the content-addressed store, hash-verified

191 * signal that the process encountered errors.
192 */
193export async function gracefulExit(code: number = 0): Promise<void> {
194 // Display session usage breakdown in verbose mode
195 displaySessionUsage();
196
197 try {
198 const runningJobs = backgroundJobService.getRunningJobCount();
199 if (runningJobs > 0) {
200 logger.debug(`Killing ${runningJobs} background job(s) on exit`);
201 backgroundJobService.killAllJobs();
202 }
203 } catch (err) {
204 logger.debug("Background job cleanup error (ignored)", err as any);
205 }
206
207 try {
208 // Flush metrics (forceFlush + shutdown inside service)
209 await telemetryService.shutdown();
210 } catch (err) {
211 logger.debug("Telemetry shutdown error (ignored)", err as any);
212 }
213
214 // If we're trying to exit with success (0) but had unhandled errors,
215 // exit with 1 instead to signal failure
216 const finalCode = code === 0 && hadUnhandledError() ? 1 : code;
217
218 // Exit the process
219 process.exit(finalCode);
220}

Callers 15

enableSigintHandlerFunction · 0.85
index.tsFile · 0.85
runCliFunction · 0.85
exit.tsFile · 0.85
handleExitResponseFunction · 0.85
serveFunction · 0.85
initializeChatHistoryFunction · 0.85
runHeadlessModeFunction · 0.85
chatFunction · 0.85
resolvePrUrlFunction · 0.85
listChecksFunction · 0.85
checksFunction · 0.85

Calls 6

displaySessionUsageFunction · 0.85
hadUnhandledErrorFunction · 0.85
getRunningJobCountMethod · 0.80
killAllJobsMethod · 0.80
debugMethod · 0.45
shutdownMethod · 0.45

Tested by

no test coverage detected