How to use the list function from pm2

Find comprehensive JavaScript pm2.list code examples handpicked from public code repositorys.

51
52
53
54
55
56
57
58
59
60
61
 */
function addWatchdogOfExistingProcesses() {
    console.trace('Getting list of processes.');


    // Gets list of process managed by pm2
    pm2.list(
        /**
         *
         * @param {Error|null} err
         * @param {ProcessDescription[]} apps
fork icon8
star icon16
watch icon0

8
9
10
11
12
13
14
15
16
17
18
  });
};


const listAsync = () => {
  return new Promise((resolve, reject) => {
    pm2.list((err, processDescriptionList) => {
      if (err) reject(err);
      resolve(processDescriptionList);
    });
  });
fork icon0
star icon0
watch icon1