From 510e6254ee09cbf405f58fcb6c0364740415a6b7 Mon Sep 17 00:00:00 2001 From: Guilherme Silva <626206+guihkx@users.noreply.github.com> Date: Mon, 27 Jul 2020 08:16:49 -0300 Subject: [PATCH] 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. --- fisher.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fisher.fish b/fisher.fish index b63c9df..bed567f 100644 --- a/fisher.fish +++ b/fisher.fish @@ -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.