mirror of
https://github.com/Unitech/pm2.git
synced 2025-12-08 20:35:53 +00:00
bugfix: try/catch around userInfo to avoid crash #3184
This commit is contained in:
parent
6f2694876f
commit
9a2a733970
@ -221,10 +221,15 @@ UX.dispAsTable = function(list, interact_infos) {
|
||||
var current_user = '';
|
||||
|
||||
if (os.userInfo)
|
||||
current_user = os.userInfo().username;
|
||||
else
|
||||
try {
|
||||
current_user = os.userInfo().username;
|
||||
} catch (err) {
|
||||
// For the case of unhandled error for uv_os_get_passwd
|
||||
// https://github.com/Unitech/pm2/issues/3184
|
||||
current_user = '';
|
||||
} else {
|
||||
current_user = process.env.USER || process.env.LNAME || process.env.USERNAME || process.env.SUDO_USER || process.env.C9_USER || process.env.LOGNAME;
|
||||
;
|
||||
}
|
||||
list.sort(function(a, b) {
|
||||
if (a.pm2_env.name < b.pm2_env.name)
|
||||
return -1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user