/** * The main entrypoint when using Bun as the runtime */ import {Termios} from './termios' export async function main(): Promise { const t = new Termios(); t.enableRawMode(); const decoder = new TextDecoder(); for await (const chunk of Bun.stdin.stream()) { const char = String(decoder.decode(chunk)).trim(); if (char === 'q') { t.disableRawMode(); return 0; } } process.on("exit", (code) => { console.log(`Process exited with code ${code}`); t.disableRawMode(); }); return -1; }