Initial working radio controller for OP25
This commit is contained in:
@@ -8,6 +8,32 @@ const log = new DebugBuilder("client", "executeConsoleCommands");
|
||||
const execCommand = promisify(exec);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} process The process to close
|
||||
* @returns {undefined} Undefined to replace the existing process in the parent
|
||||
*/
|
||||
exports.closeProcessWrapper = async (process) => {
|
||||
log.INFO("Leaving the server");
|
||||
if (!process) return undefined;
|
||||
|
||||
// Try to close the process gracefully
|
||||
await process.kill(2);
|
||||
|
||||
// Wait 25 seconds and see if the process is still open, if it is force it close
|
||||
await setTimeout(async () => {
|
||||
if (process) await process.kill(9);
|
||||
}, 25000)
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} consoleCommand
|
||||
* @returns
|
||||
*/
|
||||
exports.executeAsyncConsoleCommand = async function executeAsyncConsoleCommand(consoleCommand) {
|
||||
// Check to see if the command is a real command
|
||||
// TODO needs to be improved
|
||||
|
||||
Reference in New Issue
Block a user