pucelle / vscode-run-on-save

Run configured shell commands when a file is saved in vscode, and output configured messages on status bar.
https://marketplace.visualstudio.com/items?itemName=pucelle.run-on-save
MIT License
50 stars 11 forks source link

Variable substitution does not generate proper arguments #1

Closed DaeCatt closed 5 years ago

DaeCatt commented 5 years ago

For example, if Run on Save is called on a file located at /home/user/Project Files/file.txt and "command" is set to normalize ${file} Run on Save executes:

$ normalize /home/user/Project Files/file.txt

Which is two parameters, rather than one.

The correct behavior would be quote and escape substituted variables, so Run on Save would correctly execute:

$ normalize "/home/user/Project Files/file.txt"

With this command normalize would be provided a single correct path rather than two incorrect paths.


It is currently possible to workaround this bug somewhat by setting the command to normalize "${file}", but this will not work reliably on Unix platforms (and WSL) where filenames may contain quotes.

pucelle commented 5 years ago

Thanks for your reply, I will work on it later.

pucelle commented 5 years ago

v1.1.0 released, this version will check all command line arguments, and wrap them inside double quotes if needed. Thanks.