Skip to content

fix: correct $LESSCLOSE exit-status warning#3654

Merged
keith-hall merged 4 commits into
sharkdp:masterfrom
cuiweixie:fix/lessclose-nonzero-warning
Apr 30, 2026
Merged

fix: correct $LESSCLOSE exit-status warning#3654
keith-hall merged 4 commits into
sharkdp:masterfrom
cuiweixie:fix/lessclose-nonzero-warning

Conversation

@cuiweixie
Copy link
Copy Markdown
Contributor

Summary

Fix inverted logic when reporting $LESSCLOSE cleanup failures: bat warned on successful exit and stayed silent when the command failed.

Test plan

  • cargo test (lessopen module tests cover env handling)

The Drop cleanup for Preprocessed inverted the exit-status check, so bat
emitted a warning when LESSCLOSE exited successfully and stayed silent on
failure. Align the condition with the intended behavior.
Copy link
Copy Markdown
Collaborator

@keith-hall keith-hall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Do you think it is possible to add an assertion for this in the integration tests, to prove the warning appears only when it should?

@keith-hall keith-hall enabled auto-merge April 28, 2026 16:24
@keith-hall keith-hall merged commit 8fbc96a into sharkdp:master Apr 30, 2026
24 checks passed
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