Skip to content

Buffer hook stdin in a temporary file - #22698

Merged
niik merged 4 commits into
developmentfrom
niik-supreme-tribble
Aug 12, 2026
Merged

niik merged 4 commits into
developmentfrom
niik-supreme-tribble

Conversation

@niik

@niik niik commented Aug 11, 2026

Copy link
Copy Markdown
Member

Closes #22620

Description

  • Buffer hook stdin into a unique temporary file before invoking git hook run.
  • Pass the temporary file to --to-stdin instead of /dev/stdin, which is unavailable to Git for Windows.
  • Handle cancellation and buffering failures, report failures through hook progress, and clean up temporary files with the existing hooks directory.

Screenshots

N/A - this change does not affect the UI.

Release notes

Notes: Fixed pre-push hooks failing on Windows when reading from stdin.

niik added 4 commits August 10, 2026 14:03
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 59aa81f0-bad9-4b81-9d8c-640d2a105880
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 59aa81f0-bad9-4b81-9d8c-640d2a105880
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 59aa81f0-bad9-4b81-9d8c-640d2a105880
Copilot AI lite review requested due to automatic review settings August 11, 2026 11:50
@niik
niik requested a review from a team as a code owner August 11, 2026 11:50
@niik
niik requested a review from BagToad August 11, 2026 11:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Git hook stdin handling on Windows by buffering the hook proxy’s stdin into a temporary file and passing that file to git hook run --to-stdin=<path> (instead of /dev/stdin, which Git for Windows can’t open). It also threads the temporary hooks directory into the proxy so the buffered stdin file is cleaned up with the existing temp hooks dir lifecycle.

Changes:

  • Pass tmpHooksDir into createHooksProxy so the proxy can create per-invocation temp artifacts.
  • Replace --to-stdin=/dev/stdin with a unique temp file path and buffer the proxy stdin into that file before spawning git hook run.
  • Improve cancellation behavior by aborting buffering when the proxy connection closes, and report buffering failures via hook progress.
Show a summary per file
File Description
app/src/lib/hooks/with-hooks-env.ts Passes the per-operation temporary hooks directory into the hooks proxy and continues to clean it up in finally.
app/src/lib/hooks/hooks-proxy.ts Buffers hook stdin into a unique temp file under tmpHooksDir and passes that path to git hook run --to-stdin.

Review details

Tip

Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread app/src/lib/hooks/hooks-proxy.ts Resolved

@sergiou87 sergiou87 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it possible to have an only-Windows test for this change? It'd be nice!

@niik

niik commented Aug 12, 2026

Copy link
Copy Markdown
Member Author

Is it possible to have an only-Windows test for this change? It'd be nice!

Possible certainly and that's what I started doing but I could not see a good enough reason to have to maintain platform specific logic here. I think the benefit of being able to test just on one platform with reasonable confidence outweighs the risk here.

@niik
niik merged commit c058873 into development Aug 12, 2026
19 checks passed
@niik
niik deleted the niik-supreme-tribble branch August 12, 2026 12:47
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.

Windows: pre-push hook fails because hook proxy passes --to-stdin=/dev/stdin

3 participants