sebhildebrandt / systeminformation

System Information Library for Node.JS
MIT License
2.74k stars 311 forks source link

si.processes() return list is error #702

Closed BingKui closed 2 years ago

BingKui commented 2 years ago

Describe the bug si.processes() return list , WindowServer item name is error.

true: "WindowServer" return: "indowServer"

command is error too;

To Reproduce si.processes((data) => { const { list } = data; const result = list.filter(item => item.cpu > 10); console.log(result); });

Current Output { pid: 371, parentPid: 1, name: 'indowServer', cpu: 16.3, cpuu: 0, cpus: 0, mem: 0.7, priority: 79, memVsz: 412601104, memRss: 125504, nice: 0, started: 'Ss-67-14 2022', state: 'unknown', tty: '_windowserver', user: '/System/Library/PrivateFrameworks/SkyLight.framework/Resources/', command: 'indowServer', params: '-daemon', path: '' },

Expected behavior I need a truely returns;

{ pid: 371, parentPid: 1, name: 'WindowServer', cpu: 16.3, cpuu: 0, cpus: 0, mem: 0.7, priority: 79, memVsz: 412601104, memRss: 125504, nice: 0, started: 'Ss-67-14 2022', state: 'unknown', tty: '_windowserver', user: '/System/Library/PrivateFrameworks/SkyLight.framework/Resources/', command: 'WindowServer', params: '-daemon', path: '' },

Environment (please complete the following information):

Additional context no

sebhildebrandt commented 2 years ago

@BingKui just tried the same with the latest version ... cannot reproduce it:

My output is:

  ...
  {
    pid: 371,
    parentPid: 1,
    name: 'WindowServer',
    cpu: 21.6,
    cpuu: 0,
    cpus: 0,
    mem: 0.8,
    priority: 79,
    memVsz: 412180704,
    memRss: 253648,
    nice: 0,
    started: '2022-67-ai 05:16:32',
    state: 'sleeping',
    tty: '',
    user: '_windowserver',
    command: 'WindowServer',
    params: '-daemon',
    path: '/System/Library/PrivateFrameworks/SkyLight.framework/Resources'
  }
  ...

... can you provide the HEADER and the corresponding WindowServer line of the following command:

ps -axo pid,ppid,pcpu,pmem,pri,vsz=fake_title1,rss=fake_title2,nice,lstart,state,tty,user,command -r

I also see that the start date (started) is not correct ... this I will have to have a look at also...

sebhildebrandt commented 2 years ago

@BingKui can you also provide which systeminformation version you are using ...

So my feeling it has to do with the incorrect start date parsing ... so if you can provide the output of the upper command (header and the WindowServer line) would be great.

sebhildebrandt commented 2 years ago

@BingKui ... I pushed a possible fix here on GitHub for the start date/time parsing ... can you test this on your side ... maybe this also solves the other problem. Just pull the latest version here from GitHub and test it once again.

If not, please provide the output of the upper command. Thank you in advance

If this fixes your issue I will publish a new version on nom.

sebhildebrandt commented 2 years ago

@BingKui ... version 5.11.22 just published. This should resolve the issue with the start date and hopefully also the other issue. Can you test this on your side?

sebhildebrandt commented 2 years ago

@BingKui closing it for now ... should be solved by new version 5.11.22