Open falconscript opened 7 years ago
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:
1, define the edge ( begin and end ) of every title field
2, parse all the lines except the title line, get all the connected-domains
3, group all the connected-domains vertically overlapped.
4, a domain group belongs to a title field if they vertically overlapped
5, calculate all the edge info through the group domain and title field relations.
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. -ef
worked well for me in my test.
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