Skip to content

Commit 8689bc7

Browse files
authored
Merge pull request #3018 from MarcelBochtler/mac-arm64
Fix relaunching scancode on Apple silicon using Rosetta 2 emulation #2835
2 parents a61fe17 + f6064ea commit 8689bc7

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

configure

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ CFG_ROOT_DIR="$( cd "$( dirname "${CFG_BIN}" )" && pwd )"
119119
CFG_BIN_DIR=$CFG_ROOT_DIR/$VIRTUALENV_DIR/bin
120120

121121
# force relaunching under X86-64 architecture on macOS M1/ARM
122-
if [[ $OSTYPE == 'darwin'* && $(uname -m) == 'arm64' ]]; then
123-
arch -x86_64 /bin/bash -c "$CFG_ROOT_DIR/configure $@"
122+
if [[ $OSTYPE == 'darwin'* && $(uname -m) == 'arm64' && $(sysctl -in sysctl.proc_translated) == 0 ]]; then
123+
arch -x86_64 /bin/bash -c "$CFG_ROOT_DIR/configure $*"
124124
exit $?
125125
fi
126126

extractcode

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ SCANCODE_BIN="$( realpath "${BASH_SOURCE[0]}" )"
121121
SCANCODE_ROOT_DIR="$( cd "$( dirname "${SCANCODE_BIN}" )" && pwd )"
122122

123123
# force relaunching under X86-64 architecture on macOS M1/ARM
124-
if [[ $OSTYPE == 'darwin'* && $(uname -m) == 'arm64' ]]; then
125-
arch -x86_64 /bin/bash -c "$SCANCODE_ROOT_DIR/$COMMAND_TO_RUN $@"
124+
if [[ $OSTYPE == 'darwin'* && $(uname -m) == 'arm64' && $(sysctl -in sysctl.proc_translated) == 0 ]]; then
125+
arch -x86_64 /bin/bash -c "$SCANCODE_ROOT_DIR/$COMMAND_TO_RUN $*"
126126
exit $?
127127
fi
128128

scancode

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ SCANCODE_BIN="$( realpath "${BASH_SOURCE[0]}" )"
121121
SCANCODE_ROOT_DIR="$( cd "$( dirname "${SCANCODE_BIN}" )" && pwd )"
122122

123123
# force relaunching under X86-64 architecture on macOS M1/ARM
124-
if [[ $OSTYPE == 'darwin'* && $(uname -m) == 'arm64' ]]; then
125-
arch -x86_64 /bin/bash -c "$SCANCODE_ROOT_DIR/$COMMAND_TO_RUN $@"
124+
if [[ $OSTYPE == 'darwin'* && $(uname -m) == 'arm64' && $(sysctl -in sysctl.proc_translated) == 0 ]]; then
125+
arch -x86_64 /bin/bash -c "$SCANCODE_ROOT_DIR/$COMMAND_TO_RUN $*"
126126
exit $?
127127
fi
128128

0 commit comments

Comments
 (0)