Skip to content

Exit 1 and name the skipped subfolders when the input has nothing to process [patch] - #178

Open
matt-edmondson wants to merge 1 commit into
mainfrom
fix-empty-input-warning
Open

matt-edmondson wants to merge 1 commit into
mainfrom
fix-empty-input-warning

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #176

What

ProcessDirectory reads only the top level of --input. When every image sits in a subfolder, as in icons/ui/*.png with --input icons, the run printed Done. 0 file(s) written. and exited 0, so a build script took it as success.

Execute now handles a batch that wrote nothing and failed nothing before it reaches ExitCodeFor:

  • It prints Warning: no files to process in <input>. Only the top level of the input folder is read. Skipped subfolders: actions, ui. Dot-folders such as .git are not listed.
  • It returns ExitInvalidArguments (1), the code the issue suggested. The problem is a wrong --input, so it is a bad-arguments case, not a failed batch.

ExitCodeFor(new BatchResult(0, 0)) still returns 0, because it only maps a batch that ran. I updated that test's comment to point to the new check. The README's Features, Exit Codes and Notes sections now say that only the top level is read, and CLAUDE.md's exit-code section describes the new case.

I left the optional --recursive flag out to keep this PR small. It can be its own issue if it's wanted.

Tests (ProcessDirectoryTests)

  • AnInputWhoseImagesAllSitInSubfoldersExitsNonZeroAndNamesThem: the input has only ui/ and actions/ subfolders. Execute must return 1, write nothing, and the warning must list both subfolders.
  • DescribeEmptyInputSaysOnlyTheTopLevelIsReadWhenThereAreNoSubfolders: with no subfolders, or only a dot-folder, the warning has no subfolder list.

I disabled the new check temporarily and the first test failed. It passes with the check. The full suite passed 90 of 90, three runs in a row. The test checks the warning through DescribeEmptyInput rather than by capturing Console.Out, because the tests run in parallel and capturing the console was flaky.

Note

As in #177, restore fails locally with NU1903 (the advisory on SixLabors.ImageSharp 3.1.12), so I built with -p:NuGetAudit=false. That is not part of this change.


Generated by Claude Code

…process [patch]

Only the top level of --input is read, so an input folder whose images
all sit in subfolders printed "Done. 0 file(s) written." and exited 0.
A build script read that as success. A run that writes nothing and
fails nothing now prints a warning that names the subfolders it did not
read and exits with the invalid-arguments code. The README now says
only the top level is read.

Fixes #176

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW5GEJNk1TZFgDdUPFX

Copy link
Copy Markdown
Contributor Author

The Test jobs fail at restore with NU1903 (ImageSharp 3.1.12, GHSA-v76p-62qx-wwq2), the same as main (f640ca4). That is tracked in #155 and needs a maintainer decision there, so this PR can't fix it. With -p:NuGetAudit=false the full suite passes locally, 90 of 90, three runs in a row.


Generated by Claude Code

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.

An input folder whose images all sit in subfolders is a silent no-op: "Done. 0 file(s) written." and exit 0

2 participants