Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Parse OSX process details correctly #64

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

Open
milankinen wants to merge 3 commits into neekey:master
base: master
Choose a base branch
Loading
from milankinen:fix-incorrect-osx-pid-parsing
Open

Parse OSX process details correctly #64

milankinen wants to merge 3 commits into neekey:master from milankinen:fix-incorrect-osx-pid-parsing

Conversation

@milankinen
Copy link

@milankinen milankinen commented Aug 9, 2017

Hello!

Here is a fix for #62. TableParser was a bit too generic so I tailored the parsing logic for ps in order to improve robustness. I added a test case based on the given example output from #62.

I hope we can get this fix released asap. Our testing pipeline needs this fix because testcafe (which depends on this package) can't parse browser PID correctly, hence leaving the browser process open after every test run. 😕

mwing reacted with thumbs up emoji
Copy link
Author

@neekey have you had time to look at this yet?

Copy link
Owner

neekey commented Aug 14, 2017

Hi @milankinen thanks for your PR. Your way of parsing the output is quite the same as the original version of this module, which works in this case but will fail in other cases as well, so I won't accept this as a solution, though it works in your case.

you can take a look at this discussion neekey/table-parser#3 (comment), there are more cases like the discussion mentioned.

Actually table-parser has done its best already (since it tries to catch as much edge cases as it can), but it can't work well if the input's format is very hard to predict, there is a boundary needs to be set for table-parser's ability.

So instead of improving table-parser itself, I am thinking if there's any way to regulate the output format of ps, which is the core part of the issue. (like @falconscript did here #62 (comment))

Copy link
Owner

neekey commented Aug 14, 2017

yes, I think I can definitely narrow down the metrics to only pid, command, arguments, ppid

Copy link
Author

milankinen commented Aug 14, 2017
edited
Loading

which works in this case but will fail in other cases as well

I coudn't find those cases (not even from the table parser thread you posted). Could you provide a link to them?

So instead of improving table-parser itself, I am thinking if there's any way to regulate the output format of ps, which is the core part of the issue.

Yes that's definitely the right way, although it'd introduce non-backwards compatible API changes. The purpose of this PR is to fix the parsing without breaking the backwards compatibility so that's why I thought it could be the first step.

Copy link

Hello, when will this commit be merged into the release branch? I am dealing with an error and this is the solution needed.. I am currently using this commit in order to work now. would appreciate it if we could get in though..

raszi reacted with thumbs up emoji

Copy link

raszi commented Oct 26, 2017

I believe you could run the ps with the following args on BSDs and macOS:

$ ps -x -opid,ppid,command|head -3
 PID PPID COMMAND
 308 1 /usr/sbin/cfprefsd agent
 313 1 /usr/sbin/distnoted agent
afshing reacted with thumbs up emoji

Empact added a commit to Empact/zap-desktop that referenced this pull request Dec 24, 2017
On mac, the ps output can be misaligned, e.g. when some VSZ field is
longer than expected.
The default ps-node lookup is via ps lx, which includes:
 -l Display information associated with the following keywords:
 uid, pid, ppid, flags, cpu, pri, nice, vsz=SZ, rss, wchan,
 state=S, paddr=ADDR, tty, time, and command=CMD.
Many of these fields are unnecessary because we're looking up by name only,
so we can lookup using only the default fields of ps.
neekey/table-parser#11
neekey/ps#64 
Empact added a commit to Empact/zap-desktop that referenced this pull request Dec 25, 2017
`ps x -o pid,command` rather than `ps lx`
The default ps-node lookup is via ps lx, which includes:
 -l Display information associated with the following keywords:
 uid, pid, ppid, flags, cpu, pri, nice, vsz=SZ, rss, wchan,
 state=S, paddr=ADDR, tty, time, and command=CMD.
On mac, the `ps l` output can be misaligned, e.g. when some VSZ field is
longer than expected.
Many of these fields are unnecessary because we're looking up by name only,
so we can lookup using only the command fields of ps.
https://gist.github.com/ivankovacevic/9918272
More on the issue with ps-node:
neekey/table-parser#11
neekey/ps#64 
Empact added a commit to Empact/zap-desktop that referenced this pull request Dec 25, 2017
`ps x -o pid,command` rather than `ps lx`
The default ps-node lookup is via ps lx, which includes:
 -l Display information associated with the following keywords:
 uid, pid, ppid, flags, cpu, pri, nice, vsz=SZ, rss, wchan,
 state=S, paddr=ADDR, tty, time, and command=CMD.
On mac, the `ps l` output can be misaligned, e.g. when some VSZ field is
longer than expected.
Many of these fields are unnecessary because we're looking up by name only,
so we can lookup using only the command fields of ps.
https://gist.github.com/ivankovacevic/9918272
More on the issue with ps-node:
neekey/table-parser#11
neekey/ps#64 
Empact added a commit to Empact/zap-desktop that referenced this pull request Dec 26, 2017
`ps x -o pid,command` rather than `ps lx`
The default ps-node lookup is via ps lx, which includes:
 -l Display information associated with the following keywords:
 uid, pid, ppid, flags, cpu, pri, nice, vsz=SZ, rss, wchan,
 state=S, paddr=ADDR, tty, time, and command=CMD.
On mac, the `ps l` output can be misaligned, e.g. when some VSZ field is
longer than expected.
Many of these fields are unnecessary because we're looking up by name only,
so we can lookup using only the command fields of ps.
https://gist.github.com/ivankovacevic/9918272
More on the issue with ps-node:
neekey/table-parser#11
neekey/ps#64 
Empact added a commit to Empact/zap-desktop that referenced this pull request Dec 29, 2017
`ps x -o pid,command` rather than `ps lx`
The default ps-node lookup is via ps lx, which includes:
 -l Display information associated with the following keywords:
 uid, pid, ppid, flags, cpu, pri, nice, vsz=SZ, rss, wchan,
 state=S, paddr=ADDR, tty, time, and command=CMD.
On mac, the `ps l` output can be misaligned, e.g. when some VSZ field is
longer than expected.
Many of these fields are unnecessary because we're looking up by name only,
so we can lookup using only the command fields of ps.
https://gist.github.com/ivankovacevic/9918272
More on the issue with ps-node:
neekey/table-parser#11
neekey/ps#64 
Empact added a commit to Empact/zap-desktop that referenced this pull request Jan 2, 2018
`ps x -o pid,command` rather than `ps lx`
The default ps-node lookup is via ps lx, which includes:
 -l Display information associated with the following keywords:
 uid, pid, ppid, flags, cpu, pri, nice, vsz=SZ, rss, wchan,
 state=S, paddr=ADDR, tty, time, and command=CMD.
On mac, the `ps l` output can be misaligned, e.g. when some VSZ field is
longer than expected.
Many of these fields are unnecessary because we're looking up by name only,
so we can lookup using only the command fields of ps.
https://gist.github.com/ivankovacevic/9918272
More on the issue with ps-node:
neekey/table-parser#11
neekey/ps#64 
Empact added a commit to Empact/zap-desktop that referenced this pull request Jan 5, 2018
`ps x -o pid,command` rather than `ps lx`
The default ps-node lookup is via ps lx, which includes:
 -l Display information associated with the following keywords:
 uid, pid, ppid, flags, cpu, pri, nice, vsz=SZ, rss, wchan,
 state=S, paddr=ADDR, tty, time, and command=CMD.
On mac, the `ps l` output can be misaligned, e.g. when some VSZ field is
longer than expected.
Many of these fields are unnecessary because we're looking up by name only,
so we can lookup using only the command fields of ps.
https://gist.github.com/ivankovacevic/9918272
More on the issue with ps-node:
neekey/table-parser#11
neekey/ps#64 
Empact added a commit to Empact/zap-desktop that referenced this pull request Jan 10, 2018
`ps x -o pid,command` rather than `ps lx`
The default ps-node lookup is via ps lx, which includes:
 -l Display information associated with the following keywords:
 uid, pid, ppid, flags, cpu, pri, nice, vsz=SZ, rss, wchan,
 state=S, paddr=ADDR, tty, time, and command=CMD.
On mac, the `ps l` output can be misaligned, e.g. when some VSZ field is
longer than expected.
Many of these fields are unnecessary because we're looking up by name only,
so we can lookup using only the command fields of ps.
https://gist.github.com/ivankovacevic/9918272
More on the issue with ps-node:
neekey/table-parser#11
neekey/ps#64 
Empact added a commit to Empact/zap-desktop that referenced this pull request Jan 20, 2018
`ps x -o pid,command` rather than `ps lx`
The default ps-node lookup is via ps lx, which includes:
 -l Display information associated with the following keywords:
 uid, pid, ppid, flags, cpu, pri, nice, vsz=SZ, rss, wchan,
 state=S, paddr=ADDR, tty, time, and command=CMD.
On mac, the `ps l` output can be misaligned, e.g. when some VSZ field is
longer than expected.
Many of these fields are unnecessary because we're looking up by name only,
so we can lookup using only the command fields of ps.
https://gist.github.com/ivankovacevic/9918272
More on the issue with ps-node:
neekey/table-parser#11
neekey/ps#64 
Empact added a commit to Empact/zap-desktop that referenced this pull request Jan 22, 2018
`ps x -o pid,command` rather than `ps lx`
The default ps-node lookup is via ps lx, which includes:
 -l Display information associated with the following keywords:
 uid, pid, ppid, flags, cpu, pri, nice, vsz=SZ, rss, wchan,
 state=S, paddr=ADDR, tty, time, and command=CMD.
On mac, the `ps l` output can be misaligned, e.g. when some VSZ field is
longer than expected.
Many of these fields are unnecessary because we're looking up by name only,
so we can lookup using only the command fields of ps.
https://gist.github.com/ivankovacevic/9918272
More on the issue with ps-node:
neekey/table-parser#11
neekey/ps#64 
Empact added a commit to Empact/zap-desktop that referenced this pull request Mar 17, 2018
`ps x -o pid,command` rather than `ps lx`
The default ps-node lookup is via ps lx, which includes:
 -l Display information associated with the following keywords:
 uid, pid, ppid, flags, cpu, pri, nice, vsz=SZ, rss, wchan,
 state=S, paddr=ADDR, tty, time, and command=CMD.
On mac, the `ps l` output can be misaligned, e.g. when some VSZ field is
longer than expected.
Many of these fields are unnecessary because we're looking up by name only,
so we can lookup using only the command fields of ps.
https://gist.github.com/ivankovacevic/9918272
More on the issue with ps-node:
neekey/table-parser#11
neekey/ps#64 
Empact added a commit to Empact/zap-desktop that referenced this pull request Jun 6, 2018
`ps x -o pid,command` rather than `ps lx`
The default ps-node lookup is via ps lx, which includes:
 -l Display information associated with the following keywords:
 uid, pid, ppid, flags, cpu, pri, nice, vsz=SZ, rss, wchan,
 state=S, paddr=ADDR, tty, time, and command=CMD.
On mac, the `ps l` output can be misaligned, e.g. when some VSZ field is
longer than expected.
Many of these fields are unnecessary because we're looking up by name only,
so we can lookup using only the command fields of ps.
https://gist.github.com/ivankovacevic/9918272
More on the issue with ps-node:
neekey/table-parser#11
neekey/ps#64 
Empact added a commit to Empact/zap-desktop that referenced this pull request Jun 15, 2018
`ps x -o pid,command` rather than `ps lx`
The default ps-node lookup is via ps lx, which includes:
 -l Display information associated with the following keywords:
 uid, pid, ppid, flags, cpu, pri, nice, vsz=SZ, rss, wchan,
 state=S, paddr=ADDR, tty, time, and command=CMD.
On mac, the `ps l` output can be misaligned, e.g. when some VSZ field is
longer than expected.
Many of these fields are unnecessary because we're looking up by name only,
so we can lookup using only the command fields of ps.
https://gist.github.com/ivankovacevic/9918272
More on the issue with ps-node:
neekey/table-parser#11
neekey/ps#64 
Empact added a commit to Empact/zap-desktop that referenced this pull request Aug 17, 2018
`ps x -o pid,command` rather than `ps lx`
The default ps-node lookup is via ps lx, which includes:
 -l Display information associated with the following keywords:
 uid, pid, ppid, flags, cpu, pri, nice, vsz=SZ, rss, wchan,
 state=S, paddr=ADDR, tty, time, and command=CMD.
On mac, the `ps l` output can be misaligned, e.g. when some VSZ field is
longer than expected.
Many of these fields are unnecessary because we're looking up by name only,
so we can lookup using only the command fields of ps.
https://gist.github.com/ivankovacevic/9918272
More on the issue with ps-node:
neekey/table-parser#11
neekey/ps#64 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /