Initial working radio controller for OP25

This commit is contained in:
Logan Cusano
2023-05-20 14:31:43 -04:00
parent 0f003f907e
commit c4070cc420
6 changed files with 156 additions and 34 deletions

View File

@@ -4,6 +4,7 @@ const log = new DebugBuilder("client", "clientController");
const spawn = require('child_process').spawn;
const { resolve } = require("path");
const { closeProcessWrapper } = require("../utilities/utilities");
// Global vars
let pythonProcess;
@@ -75,11 +76,7 @@ exports.leaveServer = async (req, res) => {
log.INFO("Leaving the server");
if (!pythonProcess) return res.sendStatus(200)
await pythonProcess.kill(2);
await setTimeout(async () => {
if (pythonProcess) await pythonProcess.kill(9);
}, 25000)
pythonProcess = undefined;
pythonProcess = await closeProcessWrapper(pythonProcess);
return res.sendStatus(202);
}