arunoda / node-usage

process usage lookup with nodejs
MIT License
389 stars 93 forks source link

parsing /proc/[pid]/stat fails if a process name contains a space #4

Closed rlidwka closed 11 years ago

rlidwka commented 11 years ago
process.title = process.argv[2] || ':-) 1 2 3 4 5 6';

require('fs').readFile('/proc/'+process.pid+'/stat', 'utf8', console.log);
require('usage').lookup(process.pid, console.log);

In the example above /proc/[pid]/stat starts with this: 7014 (:-) 1 2 3 4 5 6) R 5963 7014 5963 ... and data.split(' ') parses that one incorrectly.

arunoda commented 11 years ago

This is a good fix. Thanks.

arunoda commented 11 years ago

just published version 0.3.5 with the fix.