Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 175d0fbc authored by Rob Swindell's avatar Rob Swindell 💬

Always evaluate js.on_exit() installed expressions.

I noticed that when executing an external JS with the new "Use Shell / New Context" option set to "Yes", that any expressions (strings) installed via js.on_exit() were not being executed upon exit from the script. These on-exit strings are important for restoring global state information (e.g. control key pass-through, console mode) to the original state before the JS mod made any changes.

I'm not sure why the special treatment of "scope == NULL" is through-out this function. Going back to v3.16, it appears this was special treatment for JS mods invoked via global hot key event (when scope != NULL). When invoking an xtrn JS mod with the new Context option, the scope argument is not NULL, so this check was defeating the parsing of the "exit_code" and the evaluation of any js.on_exit() installed expressions for no apparent reason. I can't think why global hot key events should be excluded from this logic either.
parent 255ffd7a
......@@ -696,13 +696,11 @@ long sbbs_t::js_execfile(const char *cmd, const char* startup_dir, JSObject* sco
JS_ExecuteScript(js_cx, js_scope, js_script, &rval);
sys_status &=~ SS_ABORT;
if(scope==NULL) {
JS_GetProperty(js_cx, js_scope, "exit_code", &rval);
if(rval!=JSVAL_VOID)
JS_ValueToInt32(js_cx,rval,&result);
JS_GetProperty(js_cx, js_scope, "exit_code", &rval);
if(rval!=JSVAL_VOID)
JS_ValueToInt32(js_cx,rval,&result);
js_EvalOnExit(js_cx, js_scope, &js_callback);
}
js_EvalOnExit(js_cx, js_scope, &js_callback);
JS_ReportPendingException(js_cx); /* Added Dec-4-2005, rswindell */
......
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