-
-
Notifications
You must be signed in to change notification settings - Fork 493
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
Fix Windows command escaping #756
Conversation
Thanks! |
@freekmurze @EmanueleCoppola Unfortunately this commit breaks the I've had a look at #681 but its not clear to me how specifically this commit solves that issue? We don't experience the issue listed in #681 although we do set the NODE_PATH env var and the Here's a simple example comparing the command output that gets sent to puppeteer: Current release - broken:
Prior release - working:
The difference being how the I think this commit should be reverted until a better solution for #681 is found. |
|
||
return escapeshellcmd($fullCommand); | ||
return $fullCommand; |
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.
Specifically its the change to this line here - escapeshellcmd
ensures that html tags such as <
and >
are properly escaped. If I revert just this line here then everything continues to work same as before. What was the reason for removing this @EmanueleCoppola ?
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.
Upon further testing it looks like escapeshellcmd
can make a mess of the command particularly for more complex page headers and can cause json parsing to break inside browser.cjs.
I have side-stepped my issue altogether by simply using writeOptionsToFile
for the time being.
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.
After looking into it more, I realized that there are several problems when dealing with Windows escaping. One of the issues is that it doesn't work well with spaces in the paths of executable files, like "C:\Program Files\nodejs\node.exe"
.
To solve this problem, the best approach could be to utilize the actual Symfony Process command escaping and let it handle the escaping of paths and commands.
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.
Yep agreed!
@BARNZ I opened a pull request that should definitely fix the command escape on Windows that should also support spaces in the path like Could you please take a look at it #757 and see if you have any problem with your specific use case? P.S. You're right #681 it's totally unrelated, I probably pasted the wrong discussion id. |
I'm encountering a similar escaping issue on Windows as described in #681.
However, in the current version, the Windows command appears to be completely broken.
This PR addresses the problem and fixes the execution on Windows.