Skip to content

Fix usort_file write condition to check error instead of output truth…#360

Open
thatch wants to merge 1 commit into
facebook:mainfrom
thatch:usort-file-empty-result
Open

Fix usort_file write condition to check error instead of output truth…#360
thatch wants to merge 1 commit into
facebook:mainfrom
thatch:usort-file-empty-result

Conversation

@thatch

@thatch thatch commented May 1, 2026

Copy link
Copy Markdown
Contributor

…iness

if result.output and write: treated b"" as "don't write", which would silently skip the write for a legitimately empty sorted file, or mask any future bug that produces empty output for non-empty input. Check result.error is None instead, which is the correct signal that sorting succeeded.

…iness

`if result.output and write:` treated b"" as "don't write", which
would silently skip the write for a legitimately empty sorted file, or
mask any future bug that produces empty output for non-empty input.
Check `result.error is None` instead, which is the correct signal
that sorting succeeded.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant