Skip to content
Snippets Groups Projects
Commit e389f2e7 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Use bbs.exec() to execute msglist.js instead of load() for on-exit clean-up

The on-exit handlers which restore the console and system flags back to their
previous states don't execute when load()'d from this script. Not sure why
(Deuce?) - using bbs.exec() as a work-around now. :-(
parent fdb743f4
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -24,7 +24,7 @@ while(bbs.online && !console.aborted) {
var cmdkeys = "LSARUFNKQ?\r";
switch(console.getkeys(cmdkeys,K_UPPER)) {
case 'L': // List/read your mail
load({}, "msglist.js", "mail","-preview");
bbs.exec("?msglist.js mail -preview");
break;
case 'R': // Read your mail
bbs.read_mail(MAIL_YOUR, user.number);
......
  • Maintainer

    It's likely because exit() isn't being called. DigitalMan, If you add exit() to the end of the script on_exit() handlers should be called. If you don't, they won't be called until something calls exit() or until the outermost script terminates.

  • Author Owner

    load() is probably just not the right thing to use in this instance. We don't want the parent script to terminate when the load'd script terminates, which would happen if it (the child script) called exit(). Not what I want.

    Also, we can't rely on the child script to call exit() anyway as it could abend with an exception instead.

  • Maintainer

    There are already some calls to exit() in the script... when a message base can't be opened or contains no messages.

  • Author Owner

    Yeah, which means it (msglist.js) should not have been load()'d to begin with, so that was a wrong turn.

    I still think here's a problem with js.on_exit() however, because when email_sec.js (which is invoked via external->js_execfile) terminated, the on-exit handlers that were installed via the load()ed msglist.js where not executed.

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment