ci(inspectcode): fix Run InspectCode step exit code 2 on Git Bash (Windows) - #250
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a Windows/Git Bash-specific failure mode in the ReSharper InspectCode workflow step where set -e -o pipefail caused an early exit when no *.slnx file existed.
Changes:
- Replaced
ls | headsolution discovery with a pipe-free glob-iteration loop over*.slnxthen*.sln. - Added inline rationale documenting the Git Bash +
pipefailinteraction that produced exit code 2.
2 tasks
Chris-Wolfgang
added a commit
that referenced
this pull request
Jul 14, 2026
…-035 docs(changelog): include #250 InspectCode SLN-detection fix in 0.3.5 entry
Chris-Wolfgang
added a commit
that referenced
this pull request
Jul 15, 2026
…fixes SC2012) Same shellcheck / pipefail interaction I fixed in #250 for the InspectCode job's SLN detection: `ls *.snupkg 2>/dev/null | head -n1` under -e -o pipefail exits the step with code 2 when the glob doesn't match, before the `if [ -z ]` fallback runs; shellcheck also flags it as SC2012 ("Use find instead of ls"). Replaced with the direct glob-loop pattern established by #250 — no pipe, no pipefail interaction, no shellcheck complaint. Fails actionlint on the previous invocation.
This was referenced Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
ReSharper InspectCodejob on windows-latest exits with code 2 in theRun InspectCodestep, with NO output between the##[endgroup]and##[error]Process completed with exit code 2— a very fast failure that pre-empts the actualjb inspectcodecall. Reproduced on PR #249's CI run.Root cause
The step's first line under
-e -o pipefailwas:SLN=$(ls *.slnx 2>/dev/null | head -n1)On Git Bash for Windows (which is the shell after #248's
runs-on: windows-latestswitch), when there are no*.slnxfiles:ls *.slnx 2>/dev/null— glob doesn't match,lsreports the literal to stderr (silenced), exits 2 ("misuse")head -n1— head returns 0 but pipefail carries ls's 2 through the pipeSLN=$(...)— under set -e + pipefail, the entire step exits 2 before theif [ -z ]fallback line even runsOn ubuntu-latest bash the same pattern happened to be tolerated (subtle differences in how set -e propagates through
$()on GNU bash), so nobody caught this until we switched runners.Fix
Replace the
ls | headpipeline with a direct glob-iteration loop:No pipes, no
ls, no pipefail interaction. Uniform behavior across Ubuntu bash and Git Bash on Windows.Protected file
Only
.github/workflows/pr.yaml. Detect .NET Projects will fail as expected → admin-bypass required.Fleet impact
Same fix needed on the 4 downstream repos where #248 landed (AuditTrail #202, ETL-SqlBulkCopy #154, System.Mail-Extensions #209, console-app-template #291) AND the 14 open
chore/add-inspectcodefleet PRs that now carry the same buggy block. I'll fold this into the same fan-out mechanism used earlier once merged.