shell: always print exit code, even on success
Ensures tool output is never blank - at minimum shows 'exit: 0'.
This commit is contained in:
parent
361a68bc3a
commit
9e07821c26
|
|
@ -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
|
||||
Loading…
Reference in New Issue