-
-
Notifications
You must be signed in to change notification settings - Fork 632
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
Make sure the path is correctly escaped in case it contains spaces. #1045
Conversation
lib/react_on_rails/utils.rb
Outdated
@@ -146,7 +146,7 @@ def required(arg_name) | |||
end | |||
|
|||
def self.prepend_cd_node_modules_directory(cmd) | |||
"cd #{ReactOnRails.configuration.node_modules_location} && #{cmd}" | |||
"cd #{Regexp::escape(ReactOnRails.configuration.node_modules_location.to_s)} && #{cmd}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this the right solution for shell escaping?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if put quotes around the value:
"cd \"#{ReactOnRails.configuration.node_modules_location}\" && #{cmd}"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! Didn't think of that. I like that solution better!
Travis failure:
|
@andrewmarkle we have this CI failure:
|
Thanks @justin808 for your patience! Should be good to go now. |
Reviewed 1 of 1 files at r2, 1 of 1 files at r3. spec/react_on_rails/test_helper/webpack_assets_compiler_spec.rb, line 27 at r3 (raw file):
If this is in a heredoc, why do you escape the Comments from Reviewable |
Please add a changelog entry Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed. Comments from Reviewable |
I couldn't get this to work otherwise. If you just add in the escape characters, the heredoc ignores the interpolation and it outputs #{Rails.root} as part of the string. Do you have another suggestion? |
LGTM Reviewed 1 of 1 files at r4. Comments from Reviewable |
Closes #1044. This fixes an issue where the test runner fails if you have spaces in your path.
This PR uses Regexp to escape the path before the command is run.
This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)