mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-13 00:36:30 +00:00
fix(install): do not use curl installed through snap (#5442)
* fix: Do not install with snap-curl Snap-installed curl doesn't work: when trying to download files from GitHub, it either fails to download the file, or fails to write the output at all. Prevent a curl program which is installed with snap from being used to download starship. * Update install.sh * Minor changes to formatting and wording
This commit is contained in:
parent
9450af9d82
commit
0e738175c5
@ -40,6 +40,14 @@ has() {
|
||||
command -v "$1" 1>/dev/null 2>&1
|
||||
}
|
||||
|
||||
curl_is_snap() {
|
||||
curl_path="$(command -v curl)"
|
||||
case "$curl_path" in
|
||||
/snap/*) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Make sure user is not using zsh or non-POSIX-mode bash, which can cause issues
|
||||
verify_shell_is_posix_or_exit() {
|
||||
if [ -n "${ZSH_VERSION+x}" ]; then
|
||||
@ -55,7 +63,6 @@ verify_shell_is_posix_or_exit() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Gets path to a temporary file, even if
|
||||
get_tmpfile() {
|
||||
suffix="$1"
|
||||
if has mktemp; then
|
||||
@ -82,7 +89,13 @@ download() {
|
||||
file="$1"
|
||||
url="$2"
|
||||
|
||||
if has curl; then
|
||||
if has curl && curl_is_snap; then
|
||||
warn "curl installed through snap cannot download starship."
|
||||
warn "See https://github.com/starship/starship/issues/5403 for details."
|
||||
warn "Searching for other HTTP download programs..."
|
||||
fi
|
||||
|
||||
if has curl && ! curl_is_snap; then
|
||||
cmd="curl --fail --silent --location --output $file $url"
|
||||
elif has wget; then
|
||||
cmd="wget --quiet --output-document=$file $url"
|
||||
|
Loading…
Reference in New Issue
Block a user