Commit 1a0d26b
committed
.github: fix samples/tasks CI step killed by default set -e
The "Smoke-test database_task argv parsing" step was failing on the
first run after the workflow landed:
Process completed with exit code 1.
Root cause: GitHub Actions' `shell: bash` wraps the run script with
`bash --noprofile --norc -eo pipefail {0}` -- the `-e` is implicit,
not opt-in. The step deliberately invokes `./database_task` with no
arguments, expecting exit status 1 so it can assert on it. But `-e`
fires on that non-zero exit before the `rc=$?` capture runs, and the
step terminates at the invocation line with no output past it.
Confirmed the failure mode locally by running the original script
under the exact same shell contract (`bash --noprofile --norc -eo
pipefail`) -- it exits 1 with no output, matching the CI log. The
libretro-common/samples workflow doesn't hit this because every
binary in that job's run allowlist is expected to exit 0; only the
deliberate-nonzero case exposes the issue.
Fix: capture the exit status in the same statement with `|| rc=$?`,
which suppresses `-e` for the known-nonzero case. Initialize rc=0
up front so the assert branch is reached even if the command somehow
succeeds. Comment added explaining why the idiom is needed -- this
is a CI-specific gotcha, not obvious from reading the script.
Reproduced the fix under the same shell contract:
[pass] database_task no-args exit=1 (expected non-zero)
step exit: 0
The archive_name_safety_test step is left unchanged. That step's
command (`timeout 60 ./archive_name_safety_test`) expects exit 0;
non-zero means a real regression and `set -e` terminating the step
is the correct behaviour there.1 parent 0ef2531 commit 1a0d26b
1 file changed
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
69 | 76 | | |
70 | 77 | | |
71 | 78 | | |
| |||
0 commit comments