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
Fixed process layer argument quoting; allows for strings with spaces. #1132
Conversation
As I mentioned in the relevant Discord message, there are basically 3 group of behaviors - MSVCRT, CommandLineToArgvW and vendor defined. Ultimately, most programs choose to support MSVCRT because it is similar to CommandLineToArgvW (probably compatible too!). This PR probably is implementing the MSVCRT convention too. Here's a description for that from Python:
Note that the definition of whitespace - Although the MSVCRT convention allows quoting non-space arguments, this is not recommended. Other than that, a In this mode the array will be concatenated with no escaping at all. This is the solution for node.js, but doesn't seem like it in Python. However, Python probably allows this by passing a single string rather than a list. This option is important for aforementioned vendor-specific convention, most notably |
Sure; instead of verbatim argument; we could also simply allow for a string to be passed as well, instead of a table. Would probably be me natural. |
I'd agree, but if we provide a string in POSIX platforms I don't know how it would be handled. I would assume Python simply uses EDIT: nevermind, Python simply uses it as argv[0], we're all good. |
8ca437c
to
27b5ad2
Compare
OK, added in the ability to specify a string; just argv[0] on POSIX; literal string on windows. Checked with python; behaviour is identical. |
… And added ability to specify a literal, in the style of python.
5731962
to
3942f2f
Compare
Tested changes on windows and everything is working normally so merging |
As discussed on discord the new changes to the lite-xl process api to properly handle argument escaping on windows introduced on lite-xl/lite-xl#1132, when passing the command as a table it double quotes all arguments and also parenthesized statements like `cmd /c (echo hello)` which results in `"cmd" "/c" "(echo hello)"`. This causes batch to error out as it improperly interprets "(echo hello)" as a whole command instead of a group of statements. To fix the issue with newer process api one would need to use a plain string instead of a table to disable the quoting mechanism when inappropriate.
… And added ability to specify a literal, in the style of python. (lite-xl#1132)
Noticed this slight bug; when passing in arguments with strings, we don't actually escape these even if passed in array form. Should be escaped, like with Linux.