From e9ce780c1d96af0c70c62bc8d053896a87f27e32 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Wed, 29 Nov 2023 14:57:30 -0500 Subject: [PATCH] Actually fix crash on macOS...somehow --- src/common/main.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/common/main.ts b/src/common/main.ts index 91aa0fc..83ddc38 100644 --- a/src/common/main.ts +++ b/src/common/main.ts @@ -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)); });