self-update: better network error handling; fix #580

A power outage could corrupt a `fisher self-update`. 
This change prevents fisher from overwriting itself to death.
pull/586/head
Guilherme Silva 4 years ago committed by GitHub
parent 994506e594
commit 510e6254ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -157,7 +157,7 @@ function _fisher_self_update -a file
echo "fetching $url" >&2
command curl -s "$url?nocache" >$file.
set -l next_version (command awk '{ print $4 } { exit }' <$file.)
set -l next_version (command awk '$4 ~ /^[0-9]+\.[0-9]+\.[0-9]+$/ { print v=$4 } { exit !v }' <$file.)
switch "$next_version"
case "" $fisher_version
command rm -f $file.

Loading…
Cancel
Save