From 836ca8607702a84bfbba8f643983049b5e1071b5 Mon Sep 17 00:00:00 2001 From: Vincent Latombe Date: Thu, 29 Aug 2024 14:46:49 +0200 Subject: [PATCH] [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. --- src/main/assembly/bin/sonar-scanner | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.39.5