Initial update to ALSA

This commit is contained in:
Logan Cusano
2023-03-26 00:03:38 -04:00
parent ce072d9287
commit d96b8ee05b
3 changed files with 39 additions and 24 deletions

View File

@@ -0,0 +1,22 @@
// 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);
exports.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();
}