Skip to content

Commit 5aa74f9

Browse files
yuchenshiyiliang114
authored andcommitted
Fix install.sh refusing to download macos-arm64 standalone. (coder#6968)
* Fix install.sh refusing to download macos-arm64 standalone. * Update tests for macos-arm64 and amd64.
1 parent 7006056 commit 5aa74f9

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

install.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,9 @@ npm_fallback() {
461461
# Determine if we have standalone releases on GitHub for the system's arch.
462462
has_standalone() {
463463
case $ARCH in
464-
amd64) return 0 ;;
465-
# We only have amd64 for macOS.
466-
arm64)
464+
arm64) return 0 ;;
465+
# We only have arm64 for macOS.
466+
amd64)
467467
[ "$(distro)" != macos ]
468468
return
469469
;;

test/scripts/install.bats

+5-5
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,15 @@ function should-use-standalone() {
132132

133133
# macOS use homebrew but falls back to standalone when brew is unavailable then
134134
# to npm for unsupported architectures.
135-
@test "$SCRIPT_NAME: macos arm64 (no brew)" {
136-
should-fallback-npm-brew "arm64"
137-
}
138135
@test "$SCRIPT_NAME: macos amd64 (no brew)" {
139-
BREW_PATH= OS=macos ARCH=amd64 run "$SCRIPT" --dry-run
136+
should-fallback-npm-brew "amd64"
137+
}
138+
@test "$SCRIPT_NAME: macos arm64 (no brew)" {
139+
BREW_PATH= OS=macos ARCH=arm64 run "$SCRIPT" --dry-run
140140
[ "$status" -eq 0 ]
141141
[ "${lines[1]}" = "Homebrew not installed." ]
142142
[ "${lines[2]}" = "Falling back to standalone installation." ]
143-
[ "${lines[3]}" = "Installing v$VERSION of the amd64 release from GitHub." ]
143+
[ "${lines[3]}" = "Installing v$VERSION of the arm64 release from GitHub." ]
144144
[[ "${lines[-6]}" = "Standalone release has been installed"* ]]
145145
}
146146
@test "$SCRIPT_NAME: macos i386 (no brew)" {

0 commit comments

Comments
 (0)