From 37f6930bf2ee9791409026ca762ab4074a69285d Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Mon, 25 Mar 2024 22:33:41 +0000 Subject: [PATCH] Quit command should abort any pending commands --- core/modules/commander.js | 7 +++++++ core/modules/commands/quit.js | 2 ++ 2 files changed, 9 insertions(+) diff --git a/core/modules/commander.js b/core/modules/commander.js index b55679a2e..127b7a698 100644 --- a/core/modules/commander.js +++ b/core/modules/commander.js @@ -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 */ diff --git a/core/modules/commands/quit.js b/core/modules/commands/quit.js index 4aad5ad83..721f00907 100644 --- a/core/modules/commands/quit.js +++ b/core/modules/commands/quit.js @@ -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;