From 3faa2c46acab04a3ea8bd4f70bc32d4787d8ec9f Mon Sep 17 00:00:00 2001 From: Robert Aboukhalil Date: Thu, 26 Aug 2021 13:36:43 -0700 Subject: [PATCH] Modify exec() so we can pass along custom arguments --- src/worker.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/worker.js b/src/worker.js index b26b6a6..86990ec 100644 --- a/src/worker.js +++ b/src/worker.js @@ -127,15 +127,18 @@ const aioli = { // ========================================================================= // Execute a command // ========================================================================= - async exec(command) + async exec(command, args=null) { // Input validation - aioli._log(`Executing: %c${command}%c`, "color:darkblue; font-weight:bold"); + aioli._log(`Executing %c${command}%c args=${args}`, "color:darkblue; font-weight:bold", ""); if(!command) throw "Expecting a command"; // Extract tool name and arguments - const args = command.split(" "); - const toolName = args.shift(); + let toolName = command; + if(args == null) { + args = command.split(" "); + toolName = args.shift(); + } // Does it match a program we've already initialized? const tools = aioli.tools.filter(d => d.program == toolName);