diff options
author | Vincent Latombe <vincent@latombe.net> | 2024-08-29 14:46:49 +0200 |
---|---|---|
committer | Eric Giffon <eric.giffon@sonarsource.com> | 2024-09-04 12:24:18 +0200 |
commit | 836ca8607702a84bfbba8f643983049b5e1071b5 (patch) | |
tree | bf85186c0a52b9812df8333c781468613bd61258 | |
parent | a3c341f0b95704ed1b1d17e2273fb0458a9c5db6 (diff) | |
download | sonar-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.
-rwxr-xr-x | src/main/assembly/bin/sonar-scanner | 2 |
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 |