Skip to content

fix: avoid trailing newline for empty Write map#270

Open
anshusinha26 wants to merge 1 commit into
joho:mainfrom
anshusinha26:fix/write-empty-map-newline
Open

fix: avoid trailing newline for empty Write map#270
anshusinha26 wants to merge 1 commit into
joho:mainfrom
anshusinha26:fix/write-empty-map-newline

Conversation

@anshusinha26

Copy link
Copy Markdown

When writing environment maps to disk with Write, an empty map should produce a zero-byte file instead of a file containing a single blank line.

This fix preserves existing behavior for non-empty maps (dotenv content remains newline-terminated) while ensuring empty-map writes do not introduce phantom content. The change includes a regression test that writes an empty map to a temporary file and asserts the file is empty.

@anshusinha26 anshusinha26 changed the title fix: empty map Write should not add trailing blank line fix: avoid trailing newline for empty Write map May 31, 2026
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.

1 participant