Skip to content

Commit

Permalink
Fix non-interactive compilation
Browse files Browse the repository at this point in the history
`.znap.compile` checks the `funcstack`, with the intent of determining
whether or not to output user visible messages -- they should only be
output when called directly from the `znap` CLI tool.

Unfortunately, this check was written in a way that means that when
called from outside of the main znap function (eg, compdump background
compilation, auto-compile), no compilation happened.

This change re-orders the checks so that `.znap.compile` works when
called from other parts of znap.

Fixes #267
  • Loading branch information
rcloran authored and marlonrichert committed Dec 14, 2023
1 parent bd7c25a commit 0425bfb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions functions/.znap.compile
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ while (( $#files[@] )); do
opt=R
fi

if [[ $funcstack[2] == znap ]] && emulate zsh -c "zcompile -U$opt -- ${(q)f}"; then
print -Pr -- "${(D)f:h}/%F{green}$f:t.zwc%f"
if emulate zsh -c "zcompile -U$opt -- ${(q)f}"; then
if [[ $funcstack[2] == znap ]] ; then
print -Pr -- "${(D)f:h}/%F{green}$f:t.zwc%f"
fi
else
ret=1
zf_rm -f -- $f.zwc
Expand Down

0 comments on commit 0425bfb

Please sign in to comment.