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

Add RELOAD sysop command to reload a (JS) command shell without logoff/on

We have to use load() (rather than js.exec) to invoke str_cmds.js so that an
exit() will actually exit. Since load() automatically does the mods vs exec
directory search-dance, that simplifies the code in default.js a little.
I'm not sure exactly why I originally chose to use js.exec() over load() for
invoking str_cmds.js, but for this feature, we need load() so let's go with
that for now.

I did encounter an issue (issue #840) while originally trying to make this
work with the original code that called js.exec(), but just punted and went
with load() instead. Perhaps if we fix issue #840, we can revert default.js
back to using js.exec() (but why we would need/want to, I'm not sure).
parent a7b3d2a6
No related branches found
No related tags found
No related merge requests found
......@@ -203,10 +203,7 @@ while(bbs.online && !js.terminated) {
cmd = console.getstr();
if(cmd == '!')
cmd = last_str_cmd;
var script = system.mods_dir + "str_cmds.js";
if(!file_exists(script))
script = system.exec_dir + "str_cmds.js";
js.exec(script, {}, cmd);
load({}, "str_cmds.js", cmd);
last_str_cmd = cmd;
continue;
}
......
......@@ -351,6 +351,11 @@ function str_cmds(str)
return;
}
if(str=="HELP")
writeln("RELOAD\tReload the current shell (if JavaScript).");
if(str=="RELOAD")
exit(0);
if(str=="HELP")
writeln("SLOG\tExecutes the slog utility to display system statistics.");
if(str=="SLOG") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment