aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/assembly/bin/sonar-runner.bat20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/main/assembly/bin/sonar-runner.bat b/src/main/assembly/bin/sonar-runner.bat
index 50d50c0..4e13424 100644
--- a/src/main/assembly/bin/sonar-runner.bat
+++ b/src/main/assembly/bin/sonar-runner.bat
@@ -9,6 +9,10 @@
@echo off
+set ERROR_CODE=0
+
+@REM set local scope for the variables with windows NT shell
+@setlocal
@REM ==== START VALIDATION ====
@REM *** JAVA EXEC VALIDATION ***
@@ -29,7 +33,7 @@ echo executable present in the PATH.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation, or add "java.exe" to the PATH
echo.
-goto end
+goto error
:foundJavaHome
if EXIST "%JAVA_HOME%\bin\java.exe" goto foundJavaExeFromJavaHome
@@ -38,7 +42,7 @@ echo.
echo ERROR: JAVA_HOME exists but does not point to a valid Java home
echo folder. No "\bin\java.exe" file can be found there.
echo.
-goto end
+goto error
:foundJavaExeFromJavaHome
set JAVA_EXEC="%JAVA_HOME%\bin\java.exe"
@@ -60,7 +64,7 @@ echo.
echo ERROR: SONAR_RUNNER_HOME exists but does not point to a valid install
echo directory: %SONAR_RUNNER_HOME%
echo.
-goto end
+goto error
@@ -71,8 +75,16 @@ echo %SONAR_RUNNER_HOME%
set PROJECT_HOME=%CD%
%JAVA_EXEC% %SONAR_RUNNER_OPTS% -classpath "%SONAR_RUNNER_HOME%\lib\sonar-runner-${project.version}.jar" "-Drunner.home=%SONAR_RUNNER_HOME%" "-Dproject.home=%PROJECT_HOME%" org.sonar.runner.Main %*
+if ERRORLEVEL 1 goto error
+goto end
-
+:error
+set ERROR_CODE=1
@REM ==== END EXECUTION ====
+
:end
+@REM set local scope for the variables with windows NT shell
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+cmd /C exit /B %ERROR_CODE%