summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Song <chips@ksong.dev>2023-10-11 08:22:34 -0500
committerGitHub <noreply@github.com>2023-10-11 15:22:34 +0200
commit0e738175c57d5789350b996b69c5713aac03835e (patch)
tree713af14ef9f1ade73e10a13b1d762058ba95dbcc
parent9450af9d8239396baae6a8184d2d2b95e3f81b0f (diff)
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
-rwxr-xr-xinstall/install.sh17
1 files changed, 15 insertions, 2 deletions
diff --git a/install/install.sh b/install/install.sh
index 494a9cbf5..80fe187a8 100755
--- a/install/install.sh
+++ b/install/install.sh
@@ -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"