Skip to content

Commit f8e312e

Browse files
authored
Merge pull request Unitech#5833 from we-fork/fix-env-output
fix: env output in pm2-describe
2 parents cef628d + 49c2824 commit f8e312e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/API/UX/pm2-describe.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,10 @@ module.exports = function(proc) {
176176
Object.keys(diff_env).forEach(function(key) {
177177
var obj = {}
178178
if (_env[key]) {
179-
obj[key] = _env[key].slice(0, process.stdout.columns - 60)
179+
// 1. fix env value is not a String and slice is undeinfed
180+
// 2. fix process.stdout.columns is undefined and causes empty string output
181+
// 3. columns defaults to 300 - same as specified in pm2-ls
182+
obj[key] = String(_env[key]).slice(0, (process.stdout.columns || 300) - 60)
180183
UxHelpers.safe_push(table_env, obj)
181184
}
182185
})

0 commit comments

Comments
 (0)