Skip to content

Commit 46aa0df

Browse files
committed
Fix zsh capture script exit code and redundant compinit
The capture script always returned exit code 2 because `return 0` inside the piped while-loop only exits the subshell, not the script. Since carapace's ActionExecCommand treats non-zero exits as errors and skips the output callback, this silently broke the zsh bridge on every invocation. Changed the unconditional `return 2` to `return 0`. Also merged the redundant double compinit call into a single call with the custom dump path, and fixed stray whitespace on the source line. Added deviation comments marking where this vendored copy diverges from upstream (Valodim/zsh-capture-completion). Assisted-by: Crush:glm-5.2
1 parent 70a0817 commit 46aa0df

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • third_party/github.com/Valodim/zsh-capture-completion

third_party/github.com/Valodim/zsh-capture-completion/capture.zsh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ setopt rcquotes
2222
PROMPT=
2323
2424
# load completion system
25+
# carapace-bridge: use dedicated dump path and source user .zshrc for fpath changes
2526
oldfpath="$fpath"
26-
autoload -U compinit && compinit
27-
compinit -d "${CARAPACE_BRIDGE_CONFIG_HOME:-$HOME/.config}/carapace/bridge/zsh/.zcompdump_capture"
28-
source "${CARAPACE_BRIDGE_CONFIG_HOME:-$HOME/.config}/carapace/bridge/zsh/.zshrc"
27+
autoload -U compinit && compinit -d "${CARAPACE_BRIDGE_CONFIG_HOME:-$HOME/.config}/carapace/bridge/zsh/.zcompdump_capture"
28+
source "${CARAPACE_BRIDGE_CONFIG_HOME:-$HOME/.config}/carapace/bridge/zsh/.zshrc"
2929
[[ "$oldfpath" != "$fpath" ]] && compinit # second call to adopt any changes to fpath
3030
3131
@@ -138,4 +138,5 @@ while zpty -r z; do :; done | while IFS= read -r line; do
138138
(( tog )) && echo -E - $line
139139
done
140140

141-
return 2
141+
# carapace-bridge: was `return 2` upstream, which always exited non-zero and broke ActionExecCommand
142+
return 0

0 commit comments

Comments
 (0)