terminal: Fix double quoting of commands on Windows cmd.exe (#47534) (cherry-pick to preview)#47627
Merged
zed-zippy[bot] merged 1 commit intov0.221.xfrom Jan 26, 2026
Merged
Conversation
Closes #47303 The command quoting for `cmd` shell was first introduced (at least in this case) in PR #41216 three months ago: https://github.com/zed-industries/zed/blob/3d4582d4dc9145270650e12f9ce5a534b888f4a2/crates/project/src/terminals.rs#L202-L210 And a month ago, PR #42382 added command quoting for `cmd` in a different place: https://github.com/zed-industries/zed/blob/3d4582d4dc9145270650e12f9ce5a534b888f4a2/crates/util/src/shell.rs#L413-L434 As a result, the command is now quoted twice when using `cmd`. `cmd` interprets the entire double-quoted string (e.g., ""command & args"") as a single (invalid) executable name, and this would lead to an error like “The system cannot find the path specified” in #47303 . The solution is to remove the redundant manual quoting in `terminals.rs` and rely on the centralized logic in `util/src/shell.rs`. /cc @Veykril @reflectronic Release Notes: - Fixed a bug where terminal tasks failed to start on Windows when using `cmd.exe`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick of #47534 to preview
Closes #47303
The command quoting for
cmdshell was first introduced (at least inthis case) in PR #41216 three months ago:
zed/crates/project/src/terminals.rs
Lines 202 to 210 in 3d4582d
And a month ago, PR #42382 added command quoting for
cmdin adifferent place:
zed/crates/util/src/shell.rs
Lines 413 to 434 in 3d4582d
As a result, the command is now quoted twice when using
cmd.cmdinterprets the entire double-quoted string (e.g., ""command & args"") as
a single (invalid) executable name, and this would lead to an error like
“The system cannot find the path specified” in #47303 .
The solution is to remove the redundant manual quoting in
terminals.rsand rely on the centralized logic in
util/src/shell.rs./cc @Veykril @reflectronic
Release Notes:
cmd.exe.