Actually fix crash on macOS...somehow

This commit is contained in:
Timothy Warren 2023-11-29 14:57:30 -05:00
parent 9711202c3b
commit e9ce780c1d

View File

@ -3,18 +3,19 @@ import { getTermios } from './termios.ts';
import Editor from './editor.ts';
export async function main() {
const { term, file, onExit, onEvent } = await getRuntime();
const rt = await getRuntime();
const { file, term } = rt;
// Setup raw mode, and tear down on error or normal exit
const t = await getTermios();
t.enableRawMode();
onExit(() => {
rt.onExit(() => {
t.disableRawMode();
t.cleanup();
});
// Setup error handler to log to file
onEvent('error', (error) => {
rt.onEvent('error', (error) => {
t.disableRawMode();
file.appendFileSync('./scroll.err', JSON.stringify(error, null, 2));
});