Skip to content

Commit 5b896ee

Browse files
committed
fix pm2 report when daemon is not running
1 parent 1d46e13 commit 5b896ee

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

lib/API/Extra.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,27 @@ module.exports = function(CLI) {
100100
var Log = require('./Log');
101101

102102
that.Client.executeRemote('getReport', {}, function(err, report) {
103+
103104
console.log()
104105
console.log()
105106
console.log()
106107
console.log('```')
107108
fmt.title('PM2 report')
108109
fmt.field('Date', new Date());
109110
fmt.sep();
110-
fmt.title(chalk.bold.blue('Daemon'));
111-
fmt.field('pm2d version', report.pm2_version);
112-
fmt.field('node version', report.node_version);
113-
fmt.field('node path', report.node_path);
114-
fmt.field('argv', report.argv);
115-
fmt.field('argv0', report.argv0);
116-
fmt.field('user', report.user);
117-
fmt.field('uid', report.uid);
118-
fmt.field('gid', report.gid);
119-
fmt.field('uptime', dayjs(new Date()).diff(report.started_at, 'minute') + 'min');
111+
112+
if (report && !err) {
113+
fmt.title(chalk.bold.blue('Daemon'));
114+
fmt.field('pm2d version', report.pm2_version);
115+
fmt.field('node version', report.node_version);
116+
fmt.field('node path', report.node_path);
117+
fmt.field('argv', report.argv);
118+
fmt.field('argv0', report.argv0);
119+
fmt.field('user', report.user);
120+
fmt.field('uid', report.uid);
121+
fmt.field('gid', report.gid);
122+
fmt.field('uptime', dayjs(new Date()).diff(report.started_at, 'minute') + 'min');
123+
}
120124

121125
fmt.sep();
122126
fmt.title(chalk.bold.blue('CLI'));

0 commit comments

Comments
 (0)