aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/assembly/bin/sonar-scanner
diff options
context:
space:
mode:
authorVincent Latombe <vincent@latombe.net>2024-08-29 14:46:49 +0200
committerEric Giffon <eric.giffon@sonarsource.com>2024-09-04 12:24:18 +0200
commit836ca8607702a84bfbba8f643983049b5e1071b5 (patch)
treebf85186c0a52b9812df8333c781468613bd61258 /src/main/assembly/bin/sonar-scanner
parenta3c341f0b95704ed1b1d17e2273fb0458a9c5db6 (diff)
downloadsonar-scanner-cli-836ca8607702a84bfbba8f643983049b5e1071b5.tar.gz
sonar-scanner-cli-836ca8607702a84bfbba8f643983049b5e1071b5.zip
[SCANCLI-153] Use shell alternative to `which`
`which` may or may not be available on host systems. There are equivalent which are shell builtin. This is essentially using the same as https://github.com/apache/maven/commit/8852b87412c0af70efcee76f1bb12bc44635aab1, which has proven to work fine on a large shell variety.
Diffstat (limited to 'src/main/assembly/bin/sonar-scanner')
-rwxr-xr-xsrc/main/assembly/bin/sonar-scanner2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/assembly/bin/sonar-scanner b/src/main/assembly/bin/sonar-scanner
index 128143f..c344131 100755
--- a/src/main/assembly/bin/sonar-scanner
+++ b/src/main/assembly/bin/sonar-scanner
@@ -48,7 +48,7 @@ if [ -n "$JAVA_HOME" ]
then
java_cmd="$JAVA_HOME/bin/java"
else
- java_cmd="`which java`"
+ java_cmd="`\\unset -f command; \\command -v java`"
fi
if [ -z "$java_cmd" -o ! -x "$java_cmd" ] ; then