| 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 | } |
| 1765 | |
| 1766 | if (that.Client.daemon_mode == false) { |
| 1767 | Common.printOut('[--no-daemon] Continue to stream logs'); |
| 1768 | Common.printOut('[--no-daemon] Exit on target PM2 exit pid=' + fs.readFileSync(conf.PM2_PID_FILE_PATH).toString()); |
| 1769 | global._auto_exit = true; |
| 1770 | return that.streamLogs('all', 0, false, 'HH:mm:ss', false); |
| 1771 | } |
| 1772 | // if (process.stdout.isTTY) if looking for start logs |
| 1773 | else if (!process.env.TRAVIS && process.env.NODE_ENV != 'test' && acted.length > 0 && (commander.attach === true)) { |
| 1774 | Common.info(`Log streaming apps id: ${chalk.cyan(acted.join(' '))}, exit with Ctrl-C or will exit in 10secs`) |
| 1775 | |
| 1776 | // setTimeout(() => { |
| 1777 | // Common.info(`Log streaming exited automatically, run 'pm2 logs' to continue watching logs`) |
| 1778 | // return that.exitCli(code ? code : conf.SUCCESS_EXIT); |
| 1779 | // }, 10000) |
| 1780 | |
| 1781 | return acted.forEach((proc_name) => { |
| 1782 | that.streamLogs(proc_name, 0, false, null, false); |
| 1783 | }) |
| 1784 | } |
| 1785 | else { |
| 1786 | return that.exitCli(code ? code : conf.SUCCESS_EXIT); |
| 1787 | } |
| 1788 | } |
| 1789 | } |
| 1790 | |
| 1791 | /** |