Commit a84a3af 1 parent 4f46411 commit a84a3af Copy full SHA for a84a3af
File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,21 @@ has() {
40
40
command -v " $1 " 1> /dev/null 2>&1
41
41
}
42
42
43
+ # Make sure user is not using zsh or non-POSIX-mode bash, which can cause issues
44
+ verify_shell_is_posix_or_exit () {
45
+ if [ -n " ${ZSH_VERSION+x} " ]; then
46
+ error " Running installation script with \` zsh\` is known to cause errors."
47
+ error " Please use \` sh\` instead."
48
+ exit 1
49
+ elif [ -n " ${BASH_VERSION+x} " ] && [ -z " ${POSIXLY_CORRECT+x} " ]; then
50
+ error " Running installation script with non-POSIX \` bash\` may cause errors."
51
+ error " Please use \` sh\` instead."
52
+ exit 1
53
+ else
54
+ true # No-op: no issues detected
55
+ fi
56
+ }
57
+
43
58
# Gets path to a temporary file, even if
44
59
get_tmpfile () {
45
60
suffix=" $1 "
@@ -355,7 +370,6 @@ print_install() {
355
370
printf " \n"
356
371
}
357
372
358
-
359
373
is_build_available () {
360
374
arch=" $1 "
361
375
platform=" $2 "
@@ -399,6 +413,9 @@ if [ -z "${BASE_URL-}" ]; then
399
413
BASE_URL=" https://github.com/starship/starship/releases"
400
414
fi
401
415
416
+ # Non-POSIX shells can break once executing code due to semantic differences
417
+ verify_shell_is_posix_or_exit
418
+
402
419
# parse argv variables
403
420
while [ " $# " -gt 0 ]; do
404
421
case " $1 " in
You can’t perform that action at this time.
0 commit comments