From 8f99abf21dd2e26c66fe7a2d81cd6084052d0996 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Wed, 6 Jun 2018 06:25:18 +0000 Subject: [PATCH] Use the js.on_exit() method of restoring the bbs.sys_status and console.ctrlkey_passthru values. This allows these critical session settings to be restored even if/when fseditor.js crashes/abends (e.g. exits unexpectedly due to unhandled JS exception). --- exec/fseditor.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/exec/fseditor.js b/exec/fseditor.js index b68041eace..be2e055f81 100644 --- a/exec/fseditor.js +++ b/exec/fseditor.js @@ -1858,7 +1858,6 @@ function edit(quote_first) } } -var old_status=bbs.sys_status; var input_filename=system.node_dir+"QUOTES.TXT"; var use_quotes=true; input_filename=file_getcase(input_filename); @@ -1883,9 +1882,10 @@ else { if(newest_filename != undefined) input_filename=newest_filename; } +js.on_exit("bbs.sys_status = " + bbs.sys_status); bbs.sys_status&=~SS_PAUSEON; bbs.sys_status|=SS_PAUSEOFF; -var oldpass=console.ctrlkey_passthru; +js.on_exit("console.ctrlkey_passthru = " + console.ctrlkey_passthru); console.ctrlkey_passthru="+ACGKLNPQRTUVWXYZ_"; /* Enable delete line in SyncTERM (Disabling ANSI Music in the process) */ console.write("\033[=1M"); @@ -1942,7 +1942,5 @@ if(edit_top==5 && info[0]!=subj) { drop_file.close(); } } -console.ctrlkey_passthru=oldpass; -bbs.sys_status=old_status; console.clear(); exit(exit_code); -- GitLab