Skip to content

Exit non-zero when a file cannot be processed - #55

Open
MPV wants to merge 1 commit into
claude/execute-returns-errorfrom
claude/nonzero-exit
Open

Exit non-zero when a file cannot be processed#55
MPV wants to merge 1 commit into
claude/execute-returns-errorfrom
claude/nonzero-exit

Conversation

@MPV

@MPV MPV commented Jul 23, 2026

Copy link
Copy Markdown
Owner

What

Count per-file processing failures and, after processing every file, return an error so main exits non-zero. Files that succeed are still printed.

Why

Per-file errors were logged but the process still exited 0, so a pipeline like kir manifests/* | xargs grype couldn't tell that some manifests failed to parse — exactly the kind of silent gap that matters for a tool feeding a vulnerability scanner.

Behavior change

A run where any file fails now exits non-zero (was 0). Output for the files that succeeded is unchanged.

How it reads in review

The change surfaces as a golden diff in the cmd approval suite: TestExecuteFileFailure's stderr golden goes from empty → 1 of 2 file(s) could not be processed. (This is why #50 converted the cmd tests to stdout/stderr approvals first.)

Stack

Base: claude/execute-returns-error (#50). Merge order: #59#50 → this → claude/error-missing-files (#57).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Pc6NAURAqjU4LYJx93tgSC

Per-file processing errors were logged but the process still exited 0, so
a pipeline like `kir manifests/* | xargs grype` could not tell that some
manifests failed to parse — exactly the kind of silent gap that matters
for a tool feeding a vulnerability scanner.

Count per-file failures and, after processing every file, return an error
so main exits non-zero. Files that succeed are still printed; only the
exit status changes.

The change is visible in the cmd approval suite: TestExecuteFileFailure's
stderr golden goes from empty to "1 of 2 file(s) could not be processed".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pc6NAURAqjU4LYJx93tgSC
@MPV
MPV force-pushed the claude/execute-returns-error branch from d81dee0 to 52bfab2 Compare July 24, 2026 06:45
@MPV
MPV force-pushed the claude/nonzero-exit branch from 33e1541 to 713ab54 Compare July 24, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants