* Description * @method speedList * @return
(code, apps_acted)
| 1705 | * @return |
| 1706 | */ |
| 1707 | speedList (code, apps_acted) { |
| 1708 | var that = this; |
| 1709 | var systemdata = null |
| 1710 | var acted = [] |
| 1711 | |
| 1712 | if ((code != 0 && code != null)) { |
| 1713 | return that.exitCli(code ? code : conf.SUCCESS_EXIT); |
| 1714 | } |
| 1715 | |
| 1716 | if (apps_acted && apps_acted.length > 0) { |
| 1717 | apps_acted.forEach(proc => { |
| 1718 | acted.push(proc.pm2_env ? proc.pm2_env.pm_id : proc.pm_id) |
| 1719 | }) |
| 1720 | } |
| 1721 | |
| 1722 | // Do nothing if PM2 called programmatically and not called from CLI (also in exitCli) |
| 1723 | if ((conf.PM2_PROGRAMMATIC && process.env.PM2_USAGE != 'CLI')) |
| 1724 | return false; |
| 1725 | |
| 1726 | // Best-effort host metrics snapshot (daemon-side SysMetrics collector); |
| 1727 | // absence just means the `host metrics` line is skipped. |
| 1728 | return that.Client.executeRemote('getSystemData', {}, (serrr, sdata) => { |
| 1729 | systemdata = sdata || null |
| 1730 | that.Client.executeRemote('getMonitorData', {}, (err, proc_list) => { |
| 1731 | doList(err, proc_list) |
| 1732 | }) |
| 1733 | }) |
| 1734 | |
| 1735 | function doList(err, list) { |
| 1736 | if (err) { |
| 1737 | if (that.gl_retry == 0) { |
| 1738 | that.gl_retry += 1; |
| 1739 | return setTimeout(that.speedList.bind(that), 1400); |
| 1740 | } |
| 1741 | console.error('Error retrieving process list: %s.\nA process seems to be on infinite loop, retry in 5 seconds',err); |
| 1742 | return that.exitCli(conf.ERROR_EXIT); |
| 1743 | } |
| 1744 | if (process.stdout.isTTY === false) { |
| 1745 | UX.list_min(list); |
| 1746 | } |
| 1747 | else if (commander.miniList && !commander.silent) |
| 1748 | UX.list_min(list); |
| 1749 | else if (!commander.silent) { |
| 1750 | if (that.gl_interact_infos) { |
| 1751 | var dashboard_url = `https://app.pm2.io/#/r/${that.gl_interact_infos.public_key}` |
| 1752 | |
| 1753 | if (that.gl_interact_infos.info_node != 'https://root.keymetrics.io') { |
| 1754 | dashboard_url = `${that.gl_interact_infos.info_node}/#/r/${that.gl_interact_infos.public_key}` |
| 1755 | } |
| 1756 | |
| 1757 | Common.printOut('%s PM2+ activated | Instance Name: %s | Dash: %s', |
| 1758 | chalk.green.bold('⇆'), |
| 1759 | chalk.bold(that.gl_interact_infos.machine_name), |
| 1760 | chalk.bold(dashboard_url)) |
| 1761 | } |
| 1762 | UX.list(list, commander, systemdata); |
| 1763 | //Common.printOut(chalk.white.italic(' Use `pm2 show <id|name>` to get more details about an app')); |
| 1764 | } |
no test coverage detected