diff --git a/src/Misc/layoutbin/RunnerService.js b/src/Misc/layoutbin/RunnerService.js index 1024e8a5e77..151f3cc9d08 100644 --- a/src/Misc/layoutbin/RunnerService.js +++ b/src/Misc/layoutbin/RunnerService.js @@ -138,6 +138,8 @@ var runService = function () { if (!stopping) { setTimeout(runService, 5000); + } else { + process.exitCode = code; } }); } catch (ex) { diff --git a/src/Misc/layoutroot/run-helper.cmd.template b/src/Misc/layoutroot/run-helper.cmd.template index 6b594d4f357..2dca76c2ce6 100644 --- a/src/Misc/layoutroot/run-helper.cmd.template +++ b/src/Misc/layoutroot/run-helper.cmd.template @@ -12,13 +12,13 @@ if %ERRORLEVEL% EQU 0 ( if %ERRORLEVEL% EQU 1 ( echo "Runner listener exit with terminated error, stop the service, no retry needed." - exit /b 0 + exit /b 1 ) if %ERRORLEVEL% EQU 2 ( echo "Runner listener exit with retryable error, re-launch runner in 5 seconds." ping 127.0.0.1 -n 6 -w 1000 >NUL - exit /b 1 + exit /b 2 ) if %ERRORLEVEL% EQU 3 ( @@ -32,7 +32,7 @@ if %ERRORLEVEL% EQU 3 ( ) ping 127.0.0.1 -n 2 -w 1000 >NUL ) - exit /b 1 + exit /b 2 ) if %ERRORLEVEL% EQU 4 ( @@ -46,13 +46,13 @@ if %ERRORLEVEL% EQU 4 ( ) ping 127.0.0.1 -n 2 -w 1000 >NUL ) - exit /b 1 + exit /b 2 ) if %ERRORLEVEL% EQU 5 ( echo "Runner listener exit with Session Conflict error, stop the service, no retry needed." - exit /b 0 + exit /b 5 ) echo "Exiting after unknown error code: %ERRORLEVEL%" -exit /b 0 \ No newline at end of file +exit /b %ERRORLEVEL% \ No newline at end of file diff --git a/src/Misc/layoutroot/run-helper.sh.template b/src/Misc/layoutroot/run-helper.sh.template index 9f2b3cc4457..0c11055eea0 100755 --- a/src/Misc/layoutroot/run-helper.sh.template +++ b/src/Misc/layoutroot/run-helper.sh.template @@ -41,7 +41,7 @@ if [[ $returnCode == 0 ]]; then exit 0 elif [[ $returnCode == 1 ]]; then echo "Runner listener exit with terminated error, stop the service, no retry needed." - exit 0 + exit 1 elif [[ $returnCode == 2 ]]; then echo "Runner listener exit with retryable error, re-launch runner in 5 seconds." "$DIR"/safe_sleep.sh 5 @@ -72,8 +72,8 @@ elif [[ $returnCode == 4 ]]; then exit 2 elif [[ $returnCode == 5 ]]; then echo "Runner listener exit with Session Conflict error, stop the service, no retry needed." - exit 0 + exit 5 else echo "Exiting with unknown error code: ${returnCode}" - exit 0 + exit $returnCode fi diff --git a/src/Misc/layoutroot/run.cmd b/src/Misc/layoutroot/run.cmd index 692b38f9b9f..c746043d08d 100644 --- a/src/Misc/layoutroot/run.cmd +++ b/src/Misc/layoutroot/run.cmd @@ -22,10 +22,10 @@ rem **************************************************************************** copy "%~dp0run-helper.cmd.template" "%~dp0run-helper.cmd" /Y call "%~dp0run-helper.cmd" %* -if %ERRORLEVEL% EQU 1 ( +if %ERRORLEVEL% EQU 2 ( echo "Restarting runner..." goto :launch_helper ) else ( echo "Exiting runner..." - exit /b 0 + exit /b %ERRORLEVEL% ) diff --git a/src/Misc/layoutroot/run.sh b/src/Misc/layoutroot/run.sh index 57f18ee00e1..31b6595eaec 100755 --- a/src/Misc/layoutroot/run.sh +++ b/src/Misc/layoutroot/run.sh @@ -21,7 +21,7 @@ run() { echo "Restarting runner..." else echo "Exiting runner..." - exit 0 + exit $returnCode fi done }