Commit e389f2e7 authored by Rob Swindell's avatar Rob Swindell

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
......@@ -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);
......
  • 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.

  • 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.

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

  • 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.

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