@@ -1005,7 +1005,7 @@ function processLoad(proc, callback) {
1005
1005
let processes = processesString . split ( '|' ) ;
1006
1006
let result = [ ] ;
1007
1007
1008
- const procSanitized = util . isPrototypePolluted ( ) ? '' : util . sanitizeShellString ( proc ) ;
1008
+ const procSanitized = util . isPrototypePolluted ( ) ? '' : ( util . sanitizeShellString ( proc ) || '*' ) ;
1009
1009
1010
1010
// from here new
1011
1011
// let result = {
@@ -1149,12 +1149,14 @@ function processLoad(proc, callback) {
1149
1149
} ) ;
1150
1150
return found ;
1151
1151
} ) ;
1152
-
1152
+ lines . shift ( ) ;
1153
1153
lines . forEach ( function ( line ) {
1154
1154
let data = line . trim ( ) . replace ( / + / g, ' ' ) . split ( ' ' ) ;
1155
1155
if ( data . length > 4 ) {
1156
+ const linuxName = data [ 4 ] . indexOf ( '/' ) >= 0 ? data [ 4 ] . substring ( 0 , data [ 4 ] . indexOf ( '/' ) - 1 ) : data [ 4 ] ;
1157
+ const name = _linux ? ( linuxName ) : data [ 4 ] . substring ( data [ 4 ] . lastIndexOf ( '/' ) + 1 ) ;
1156
1158
procStats . push ( {
1157
- name : data [ 4 ] . substring ( data [ 4 ] . lastIndexOf ( '/' ) + 1 ) ,
1159
+ name,
1158
1160
pid : parseInt ( data [ 0 ] ) || 0 ,
1159
1161
ppid : parseInt ( data [ 1 ] ) || 0 ,
1160
1162
cpu : parseFloat ( data [ 2 ] . replace ( ',' , '.' ) ) ,
@@ -1166,7 +1168,7 @@ function processLoad(proc, callback) {
1166
1168
procStats . forEach ( function ( item ) {
1167
1169
let listPos = - 1 ;
1168
1170
let inList = false ;
1169
- let name = '' ;
1171
+ let name = item . name ;
1170
1172
for ( let j = 0 ; j < result . length ; j ++ ) {
1171
1173
if ( item . name . toLowerCase ( ) . indexOf ( result [ j ] . proc . toLowerCase ( ) ) >= 0 ) {
1172
1174
listPos = j ;
@@ -1181,13 +1183,15 @@ function processLoad(proc, callback) {
1181
1183
} ) ;
1182
1184
if ( ( processesString === '*' ) || inList ) {
1183
1185
if ( listPos < 0 ) {
1184
- result . push ( {
1185
- proc : name ,
1186
- pid : item . pid ,
1187
- pids : [ item . pid ] ,
1188
- cpu : item . cpu ,
1189
- mem : item . mem
1190
- } ) ;
1186
+ if ( name ) {
1187
+ result . push ( {
1188
+ proc : name ,
1189
+ pid : item . pid ,
1190
+ pids : [ item . pid ] ,
1191
+ cpu : item . cpu ,
1192
+ mem : item . mem
1193
+ } ) ;
1194
+ }
1191
1195
} else {
1192
1196
if ( item . ppid < 10 ) {
1193
1197
result [ listPos ] . pid = item . pid ;
0 commit comments