Quit command should abort any pending commands

This commit is contained in:
Jeremy Ruston 2024-03-25 22:33:41 +00:00
parent 4b1affee50
commit 37f6930bf2
2 changed files with 9 additions and 0 deletions

View File

@ -38,6 +38,13 @@ Commander.prototype.log = function(str) {
}
};
/*
Clear pending commands
*/
Commander.prototype.clearCommands = function() {
this.commandTokens = this.commandTokens.slice(0,this.nextToken);
};
/*
Write a string if verbose flag is set
*/

View File

@ -25,6 +25,8 @@ var Command = function(params,commander,callback) {
};
Command.prototype.execute = function() {
// Clear any pending commands
this.commander.clearCommands();
// We don't actually quit, we just issue the "th-quit" hook to give listeners a chance to exit
$tw.hooks.invokeHook("th-quit");
return null;