Skip to content

Make in-place WriteFile filtering safe - #253

Closed
draarivpatel-ui wants to merge 1 commit into
bitfield:masterfrom
draarivpatel-ui:fix-in-place-writefile
Closed

draarivpatel-ui wants to merge 1 commit into
bitfield:masterfrom
draarivpatel-ui:fix-in-place-writefile

Conversation

@draarivpatel-ui

Copy link
Copy Markdown

Fixes #137.

Summary

  • Track when a pipe originally reads a file.
  • When WriteFile truncates that same file, read the pipeline fully before opening the destination.
  • Preserve the existing streaming behavior for writes to a different file and for append writes.
  • Add a regression test for in-place filtering.

Verification

  • go test . -run TestWriteFile -count=1
  • go test ./...
  • go vet ./...

Copilot AI balanced review requested due to automatic review settings November 25, 2026 19:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@bitfield

Copy link
Copy Markdown
Owner

This is interesting, but on balance I think it adds a bit too much complexity for the benefit.

@bitfield bitfield closed this Nov 26, 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.

WriteFile occassionaly truncates files entirely

3 participants