shell: always print exit code, even on success

Ensures tool output is never blank - at minimum shows 'exit: 0'.
This commit is contained in:
Levi Neely 2026-08-05 08:25:41 +02:00
parent 361a68bc3a
commit 9e07821c26
1 changed files with 7 additions and 1 deletions

View File

@ -30,4 +30,10 @@ fi
# Execute the command. The sandbox (landlock) is already applied by toolsrv.
# We use eval to handle pipes, redirects, and compound commands.
eval "$cmd"
# Capture output and exit code, always report both.
output=$(eval "$cmd" 2>&1) && rc=$? || rc=$?
if [ -n "$output" ]; then
printf '%s\n' "$output"
fi
echo "exit: $rc"
exit $rc