From: Vincent Latombe Date: Thu, 29 Aug 2024 12:46:49 +0000 (+0200) Subject: [SCANCLI-153] Use shell alternative to `which` X-Git-Tag: 6.2.0.4578~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=836ca8607702a84bfbba8f643983049b5e1071b5;p=sonar-scanner-cli.git [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. --- 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