// Modules import { promisify } from 'util'; // Debug import ModuleDebugBuilder from "../utilities/moduleDebugBuilder.js"; // Global Vars const log = new ModuleDebugBuilder("bot", "executeConsoleCommand"); const exec = promisify(require('child_process').exec); export default function executeAsyncConsoleCommand(consoleCommand) { // Check to see if the command is a real command // TODO needs to be improved const acceptableCommands = [ "arecord -L" ]; if (!acceptableCommands.includes(consoleCommand)) { log.WARN("Console command is not acceptable: ", consoleCommand); return undefined; } const tempOutput = exec(); // TODO add some error checking return tempOutput.stdout.trim(); }