Exit run scripts with the code that stopped the restart loop (#1212)

run-controller.sh and run-host.sh ran `exit $?` after the `[[ ]]` test,
so they exited with the test's status (0) even when the process exited
with 8 to ask not to be restarted. Save the status before testing it.

The .cmd scripts now pass 8 to `exit /b` explicitly instead of relying on
a bare `exit /b` to carry the errorlevel through.

Closes #1208.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
BastiaanandClaude Opus 5.5 authored and GitHub committed 2026-11-17 10:44:17 +00:00
1 parent 154ebe294a
commit ec2bc6504b
2 files changed
+20 -4

No files matched your search

+6 -4
View File
@@ -446,7 +446,7 @@ set "NODE_OPTIONS=--enable-source-maps %NODE_OPTIONS%"
:restart
call .\\node_modules\\.bin\\clusteriocontroller.cmd run --can-restart
if %errorlevel% equ 0 exit /b
if %errorlevel% equ 8 exit /b
if %errorlevel% equ 8 exit /b 8
goto restart
`
);
@@ -458,7 +458,8 @@ goto restart
export "NODE_OPTIONS=--enable-source-maps $NODE_OPTIONS"
while true; do
./node_modules/.bin/clusteriocontroller run --can-restart
if [[ $? -eq 0 || $? -eq 8 ]]; then exit $?; fi
code=$?
if [[ $code -eq 0 || $code -eq 8 ]]; then exit $code; fi
done
`,
{ mode: 0o755 },
@@ -498,7 +499,7 @@ set "NODE_OPTIONS=--enable-source-maps %NODE_OPTIONS%"
${extraCaCertsLine}:restart
call .\\node_modules\\.bin\\clusteriohost.cmd run --can-restart
if %errorlevel% equ 0 exit /b
if %errorlevel% equ 8 exit /b
if %errorlevel% equ 8 exit /b 8
goto restart
`
);
@@ -511,7 +512,8 @@ goto restart
export "NODE_OPTIONS=--enable-source-maps $NODE_OPTIONS"
${extraCaCertsLine}while true; do
./node_modules/.bin/clusteriohost run --can-restart
if [[ $? -eq 0 || $? -eq 8 ]]; then exit $?; fi
code=$?
if [[ $code -eq 0 || $code -eq 8 ]]; then exit $code; fi
done
`,
{ mode: 0o755 },