This commit is contained in:
sneakers-the-rat 2023-07-26 19:19:25 -07:00
parent 3607882eb7
commit 5cfe6da638
2 changed files with 9 additions and 9 deletions

View file

@ -52,6 +52,7 @@ AppDataSource.initialize()
await MatterbridgeManager.spawnAll(); await MatterbridgeManager.spawnAll();
console.log('Spawned group processes:'); console.log('Spawned group processes:');
console.log(MatterbridgeManager.processes); let proclist = await MatterbridgeManager.processes;
console.log(proclist);
}) })

View file

@ -79,11 +79,11 @@ class MatterbridgeManager {
) )
} }
get processes(): Process[] { get processes(): Promise<Process[]> {
let processes: Process[] = [] return new Promise((resolve, reject) => {
pm2.list() pm2.list((err:any, list:[]) => {
.then((err:any, list:[]) => { if (err) reject(err);
processes = list.map((proc:any) => { else resolve(list.map((proc:any) => {
return <Process>{ return <Process>{
name: proc.name, name: proc.name,
pid: proc.pid, pid: proc.pid,
@ -100,9 +100,8 @@ class MatterbridgeManager {
pm_pid_path: proc.pm2_env.pm_pid_path, pm_pid_path: proc.pm2_env.pm_pid_path,
} }
} }
}) }))
}) })})
return processes
} }
} }