Fix reload

This commit is contained in:
Christopher Cookman 2024-12-19 15:38:22 -07:00
parent df6741b452
commit 3ed7d3aa58

View file

@ -72,21 +72,17 @@ const json2csv = (obj) => { // Specifically for CDR
const reload = () => {
// We're gonna start converting all the old gql commands to using mysql `system fwconsole reload` query
return new Promise((resolve, reject) => {
sshConn.exec('fwconsole reload', (err, stream) => {
sshConn.exec('fwconsole reload --json', (err, stream) => {
if (err) {
reject(err);
}
stream.on('data', (data) => {
// is there a way to send this data without resolving the promise?
console.log(data.toString());
});
stream.on('exit', (code, signal) => {
if (code == 0) {
resolve(code);
} else {
reject("Error reloading FreePBX");
dt = JSON.parse(data.toString())
if (dt.message == "Reload Complete") {
resolve(dt);
}
})
});
});
});
}