File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change 129129if [[ $OSTYPE == ' darwin' * ]]; then
130130 # We cannot use uname to determine the _machine_ architecture:
131131 # https://github.com/quarto-dev/quarto-cli/issues/2420#issuecomment-1245768732
132- FULLARCH=" $( /usr/sbin/sysctl machdep.cpu.brand_string) "
133-
134- if [[ $FULLARCH == * " Intel" * ]]; then
132+ # However, sysctl can return unexpected values in sandboxed/virtualized environments.
133+ # Use sysctl -n to get just the value, and check multiple possible patterns.
134+ FULLARCH=" $( /usr/sbin/sysctl -n machdep.cpu.brand_string 2> /dev/null) "
135+
136+ if [[ $FULLARCH == * " Intel" * ]] || [[ $FULLARCH == * " Xeon" * ]] || [[ $FULLARCH == * " Core" * ]]; then
135137 ARCH_DIR=x86_64
136- elif [[ $FULLARCH == * " Apple" * ]]; then
138+ elif [[ $FULLARCH == * " Apple" * ]] || [[ $FULLARCH == * " ARM " * ]] ; then
137139 ARCH_DIR=aarch64
138140 else
139- echo " quarto script failed: unrecognized architecture " ${FULLARCH}
140- exit 1
141+ # Fallback to uname -m if sysctl doesn't give us recognizable output
142+ # This helps with sandboxed/virtualized environments
143+ UNAME_ARCH=$( uname -m)
144+ if [[ $UNAME_ARCH == " x86_64" ]]; then
145+ ARCH_DIR=x86_64
146+ elif [[ $UNAME_ARCH == " arm64" ]]; then
147+ ARCH_DIR=aarch64
148+ else
149+ echo " quarto script failed: unrecognized architecture. sysctl returned: '${FULLARCH} ', uname -m returned: '${UNAME_ARCH} '"
150+ exit 1
151+ fi
141152 fi
142153
143154else
You can’t perform that action at this time.
0 commit comments