Fix running Python commands that include paths with spaces (#21981)
This PR fixes running Python commands that include paths with spaces by wrapping python commands and their arguments in quotation marks. I fixed this only in Python as I noticed this while trying to run `pytest` in Zed. Probably this is not the best approach as it doesn't fix other languages too, though I don't know enough about the codebase to fix it like that. I'm not even sure if it's actually feasible right now. I didn't add tests for this either as I couldn't really understand how to easily to that, I tried to look at other languages but couldn't find one that tests their `ContextProvider` directly. Release Notes: - Fix running Python commands that include paths with spaces --------- Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
This commit is contained in:
parent
e53c1a8ee3
commit
06edcd18be
2 changed files with 17 additions and 7 deletions
|
@ -135,6 +135,10 @@ impl VariableName {
|
|||
pub fn template_value(&self) -> String {
|
||||
format!("${self}")
|
||||
}
|
||||
/// Generates a `"$VARIABLE"`-like string, to be used instead of `Self::template_value` when expanded value could contain spaces or special characters.
|
||||
pub fn template_value_with_whitespace(&self) -> String {
|
||||
format!("\"${self}\"")
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for VariableName {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue