(next: {
showExit: boolean
sessionTitle?: string
sessionID?: string
history?: RunPrompt[]
})
| 303 | attachSigint() |
| 304 | |
| 305 | const close = async (next: { |
| 306 | showExit: boolean |
| 307 | sessionTitle?: string |
| 308 | sessionID?: string |
| 309 | history?: RunPrompt[] |
| 310 | }) => { |
| 311 | if (closed) { |
| 312 | return |
| 313 | } |
| 314 | |
| 315 | closed = true |
| 316 | detachSigint() |
| 317 | let wroteExit = false |
| 318 | |
| 319 | try { |
| 320 | await footer.idle().catch(() => {}) |
| 321 | |
| 322 | const show = renderer.isDestroyed ? false : next.showExit |
| 323 | if (!renderer.isDestroyed && show) { |
| 324 | const sessionID = next.sessionID || input.getSessionID?.() || input.sessionID |
| 325 | const splash = splashInfo(next.sessionTitle ?? input.sessionTitle, next.history ?? input.history) |
| 326 | wroteExit = queueSplash( |
| 327 | renderer, |
| 328 | state, |
| 329 | "exit", |
| 330 | exitSplash({ |
| 331 | ...splashMeta({ |
| 332 | title: splash.title, |
| 333 | session_id: sessionID, |
| 334 | }), |
| 335 | theme: footer.currentTheme().splash, |
| 336 | }), |
| 337 | ) |
| 338 | await renderer.idle().catch(() => {}) |
| 339 | } |
| 340 | } finally { |
| 341 | footer.close() |
| 342 | await footer.idle().catch(() => {}) |
| 343 | footer.destroy() |
| 344 | unregisterKeymap?.() |
| 345 | shutdown(renderer) |
| 346 | if (!wroteExit) { |
| 347 | process.stdout.write("\n") |
| 348 | } |
| 349 | source.cleanup?.() |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | return { |
| 354 | footer, |
nothing calls this directly
no test coverage detected