Commit 66bfd795223b05652064ea6c8d0eca6a42673040
Merge pull request #74 from coreyjewett/master
localize and don't leak cross-platform md5 function
Showing 1 changed file Side-by-side Diff
antigen.zsh
| ... | ... | @@ -15,9 +15,6 @@ local _ANTIGEN_INSTALL_DIR="$(cd "$(dirname "$0")" && pwd)" |
| 15 | 15 | typeset -a __deferred_compdefs |
| 16 | 16 | compdef () { __deferred_compdefs=($__deferred_compdefs "$*") } |
| 17 | 17 | |
| 18 | -# bsd/osx md5 v.s. linux md5sum | |
| 19 | -chksum() { (md5sum; test $? = 127 && md5) 2>/dev/null | cut -d' ' -f1 } | |
| 20 | - | |
| 21 | 18 | # Syntaxes |
| 22 | 19 | # antigen-bundle <url> [<loc>=/] |
| 23 | 20 | # Keyword only arguments: |
| ... | ... | @@ -497,7 +494,9 @@ antigen-snapshot () { |
| 497 | 494 | echo -n " created_on='$(date)';" |
| 498 | 495 | |
| 499 | 496 | # Add a checksum with the md5 checksum of all the snapshot lines. |
| 497 | + chksum() { (md5sum; test $? = 127 && md5) 2>/dev/null | cut -d' ' -f1 } | |
| 500 | 498 | local checksum="$(echo "$snapshot_content" | chksum)" |
| 499 | + unset -f chksum; | |
| 501 | 500 | echo -n " checksum='${checksum%% *}';" |
| 502 | 501 | |
| 503 | 502 | # A newline after the metadata and then the snapshot lines. |