INNER CODE UNIT · TypeScript
shutdownNow
Hmbown/CodeWhale · crates/tui/extension-host/src/main.ts:91
function shutdownNow(code: number) {
// Let queued frames flush before exiting.
channelWrite('', () => realExit(code))
setTimeout(() => realExit(code), 200).unref()
}
const rpc = new RpcPeer((message: Message) => {
channelWrite(encodeFrame(message))
})
const host = new HostRoot(rpc)
let initialized = false
rpc.onRequest('host/initialize', (params: any) => {
if (params.protocol !== PROTOCOL_VERSION) {
stderrWrite(`codewhale-extension-host: core speaks protocol ${params.protocol}, host speaks ${PROTOCOL_VERSION}\n`)
setImmediate(() => realExit(78))
throw new RpcError(ErrorCode.InvalidParams, `unsupported protocol ${params.protocol}`)
}