浏览代码

fix(rust): fix `cargo` completion when sysroot contains spaces (#10571)

When generating completions for Cargo, if the Rust sysroot
(i.e. `rustc +${${(z)$(rustup default)}[1]} --print sysroot`) contains
spaces, Cargo completions will not work because the spaces are not
escaped, thus passing two arguments to the "source" command instead of
one. The spaces need to be escaped for this to work.
Joey Territo 2 年之前
父节点
当前提交
c6e7f8905f
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      plugins/rust/rust.plugin.zsh

+ 1 - 1
plugins/rust/rust.plugin.zsh

@@ -27,5 +27,5 @@ fi
 rustup completions zsh >| "$ZSH_CACHE_DIR/completions/_rustup" &|
 cat >| "$ZSH_CACHE_DIR/completions/_cargo" <<'EOF'
 #compdef cargo
-source $(rustc +${${(z)$(rustup default)}[1]} --print sysroot)/share/zsh/site-functions/_cargo
+source "$(rustc +${${(z)$(rustup default)}[1]} --print sysroot)"/share/zsh/site-functions/_cargo
 EOF