aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/assembly
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2013-01-04 14:29:16 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2013-01-04 15:43:23 +0100
commitb3d8968c56ea127efd078b9f95af84a592ce9c75 (patch)
tree6fb3eb6ea13ea79e167384587eb48fc50b94b13c /src/main/assembly
parente6cfa600ec5a5505aec3538057dab00744e22bf7 (diff)
downloadsonar-scanner-cli-b3d8968c56ea127efd078b9f95af84a592ce9c75.tar.gz
sonar-scanner-cli-b3d8968c56ea127efd078b9f95af84a592ce9c75.zip
SONARPLUGINS-2296 BAT script does not always return the exit code
Diffstat (limited to 'src/main/assembly')
-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%