Actually fix crash on macOS...somehow
This commit is contained in:
parent
9711202c3b
commit
e9ce780c1d
@ -3,18 +3,19 @@ import { getTermios } from './termios.ts';
|
|||||||
import Editor from './editor.ts';
|
import Editor from './editor.ts';
|
||||||
|
|
||||||
export async function main() {
|
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
|
// Setup raw mode, and tear down on error or normal exit
|
||||||
const t = await getTermios();
|
const t = await getTermios();
|
||||||
t.enableRawMode();
|
t.enableRawMode();
|
||||||
onExit(() => {
|
rt.onExit(() => {
|
||||||
t.disableRawMode();
|
t.disableRawMode();
|
||||||
t.cleanup();
|
t.cleanup();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Setup error handler to log to file
|
// Setup error handler to log to file
|
||||||
onEvent('error', (error) => {
|
rt.onEvent('error', (error) => {
|
||||||
t.disableRawMode();
|
t.disableRawMode();
|
||||||
file.appendFileSync('./scroll.err', JSON.stringify(error, null, 2));
|
file.appendFileSync('./scroll.err', JSON.stringify(error, null, 2));
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user