Browse Source

SONARPLUGINS-2296 BAT script does not always return the exit code

tags/2.5-rc1
Julien HENRY 11 years ago
parent
commit
b3d8968c56
1 changed files with 16 additions and 4 deletions
  1. 16
    4
      src/main/assembly/bin/sonar-runner.bat

+ 16
- 4
src/main/assembly/bin/sonar-runner.bat View File

@@ -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%

Loading…
Cancel
Save