Added killall command to terminal

This commit is contained in:
Daniel Xie 2017-06-05 12:59:30 -05:00
parent 0dc3d56e3c
commit f7018f082c
3 changed files with 13 additions and 1 deletions

@ -162,6 +162,7 @@ CONSTANTS = {
"hostname Displays the hostname of the machine<br>" +
"ifconfig Displays the IP address of the machine<br>" +
"kill [script] Stops a script that is running on the current machine<br>" +
"killall Stops all running scripts on the current machine<br>" +
"ls Displays all programs and scripts on the machine<br>" +
"mem [script] Displays the amount of RAM the script requires to run<br>" +
"nano [script] Text editor - Open up and edit a script<br>" +

@ -256,6 +256,10 @@ function evaluate(exp, workerScript) {
}).catch(function(e) {
reject(e);
});
} else if (exp.func.value == "kill") {
} else if (exp.func.value == "killall") {
} else if (exp.func.value == "scp") {
if (exp.args.length != 2) {
return reject(makeRuntimeRejectMsg(workerScript, "scp() call has incorrect number of arguments. Takes 2 arguments"));

@ -236,7 +236,7 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) {
//Autocomplete the command
if (index == -1) {
return ["alias", "analyze", "cat", "clear", "cls", "connect", "free",
"hack", "help", "home", "hostname", "ifconfig", "kill",
"hack", "help", "home", "hostname", "ifconfig", "kill", "killall",
"ls", "mem", "nano", "ps", "rm", "run", "scan", "scan-analyze",
"scp", "sudov", "tail", "top"];
}
@ -715,6 +715,13 @@ var Terminal = {
}
post("No such script is running. Nothing to kill");
break;
case "killall":
var s = Player.getCurrentServer();
for (var i = s.runningScripts.length; i >= 0; --i) {
killWorkerScript(s.runningScripts[i], s.ip);
}
post("Killing all running scripts. May take up to a few minutes for the scripts to die...");
break;
case "ls":
Terminal.executeListCommand(commandArray);
break;