Fix parsing arguments with spacing#74
Closed
addisonElliott wants to merge 2 commits intoneekey:masterfrom
Closed
Conversation
…unded by quotations This is done by calling /proc/<PID>/cmdline where the arguments are separated by NUL characters rather than spaces. This can then be split up and parsed.
Author
|
@herve-g Can you try out this code if you get a chance? It should resolve your issue. Also, I am interested to see if my PR slows things down. In theory, I don't think so but it can't hurt to be sure. |
Author
|
/proc//cmdline does not work for OS X. Will need to do additional research. Plus side is that this is working for Linux systems? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes issue #11.
Uses different approach from #56. When going through each file, if the file contains a space (meaning multiple arguments) and we're not on Windows, then it will attempt to use the following method to get the correct arguments.
It reads all lines from proc//cmdline. This contains the command used where each argument is separated by a NUL (0x00) character rather than spaces. So this means any spaces that are within the arguments themselves will be ignored.
Some particular notes:
Interested in input, but I believe this method will be faster than #56 because in one file read it knows what the correct command arguments are rather than trying all combinations.
Credit goes to @moos because I basically used his test from PR and modified to get it working. Quite brilliant actually!