-
Notifications
You must be signed in to change notification settings - Fork 869
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
Wrong parsing of arguments in install-node-and-nmp #336
Comments
Would it be an option to split on space except when there are quotes? Is there a simple Java way to do that? |
This is tricky, what you are looking for is really some command line parser. The quotes may be escaped etc. There is whole apache project for that. As I see it you want to pass arguments to a process. This is really Again, if you are OK with that I can do the coding a pull request. |
Ok, let's go for it. |
Any news on this issue? |
+1 for fixing this issue |
See the linked PR. It resolves the issue without introducing a new configuration but makes parsing the arguments list a bit smarter. Introducing a new configuration is quite an effort compared to what is proposed here as a couple of places have to be touched. With that PR only the logic of 2 well defined methods has been changed and testing guarantees that the (proper) behaviour as it has been in place before has not been changed. The breaking change of the misbehaviour is probably a minimal risk from my perspective. |
fix(arguments): respect quotes splitting arguments by whitespaces (#336)
I need to provide custom
.npmrc
to thenpm install
command. The.npmrc
is located in root of my project. My plugin configuration looks as:The quotes
""
are provided because this runs on my Jenkins CI server and it constructs the temp folder for CI build out of project name which contains spaces. Unfortunately the the args are simply split on\s+
which ignores the quotes hence cannot be used with custom.npmrc
located in path which contains spaces. The issue can be seen here:https://github.com/eirslett/frontend-maven-plugin/blob/master/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/NodeTaskExecutor.java#L79
IMHO the problem is you take all the arguments as single String. I suggest you have option to provide
List
of arguments instead and take them as they are. To make the change backward compatible you can provide new list property like<argumentsList>
and use the one which is set, fail if both are set. The fixed<configuration />
may look like:Overall doing split on space looks dangerous to me. Let me know if you need help with this, will be glad to assist.
The text was updated successfully, but these errors were encountered: