-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TableParser parsing data incorrectly #62
Comments
An option I've found is to modify psargs as passed to ps-node to get the correct output: // Find running tor process
ps.lookup({ command: 'tor', psargs: 'awwxo pid,comm,args,ppid', }, (err, resultList) => {
console.log(err, resultList);
}); However, for some of the processes, the first argument is the process name itself. This isn't a problem for me, but it might be for some users. |
@falconscript thanks for reporting, I will take a look later! |
According the current table-parser's algorithm:
So the problem caused by this overlapping: hmm.. very annoying, I might have to improve the algorithm, but might not be soon, any suggestion will be appreciated. |
I'm more surprised that the table can be split consistently at all. I wouldn't expect whitespace splitting to work for many cases. I mentioned above that changing your default arguments sent to ps from 'lx' to 'awwxo pid,comm,args,ppid' specifies the desired fields and their order, since ps doesn't use them all anyway. This works fine for me, and probably would work overall, but should get a little testing on Mac/Linux variants. |
The awwxo suggestion truncates the command name on centos 7. |
ps-node version: "0.1.6"
table-parser version: "0.1.3"
I've been running a node process for a while now without problems that uses ps-node every few minutes. But I also run a few other CPU intensive processes on the machine.
One day it stopped working, maybe due to PIDs, used memory, or total CPU time getting too high. I didn't step through TableParser to find where it goes wrong. I've supplied some code here with my output (with some process names and arguments redacted) that will recreate the problem.
Maybe it's time to switch from Unix ps to using something like:
https://www.npmjs.com/package/procps
The text was updated successfully, but these errors were encountered: