Files
bun.sh/src/io
Claude Bot ed05433496 fix(windows): handle libuv 1.51.0 spurious 0-byte pipe reads (#23071)
### What does this PR do?

Fixes #23071 - package.json scripts hanging on Windows in Bun v1.2.23.

The issue was introduced by the libuv 1.51.0 update in commit e3783c244f.
In libuv 1.51.0, Windows pipes can return 0-byte reads even when not at
EOF. The libuv update changed the stream read callback to use the actual
bytes read (`nreads`) instead of the full buffer, which exposed this
behavior.

WindowsBufferedReader was calling `onRead(.drained)` for 0-byte reads,
which would process the empty chunk but then never continue reading,
causing the process to hang waiting for data that never arrives.

The fix is simple: when we get a 0-byte read (nread == 0), just ignore
it and return. libuv will call us again when there's actual data. This
matches the intent of the fix that was already applied to FileReader.zig
in the same libuv update commit.

### How did you verify your code works?

The reproduction case from #23071:
1. `bun init bun-demo`
2. Add script: `{"scripts": {"dev": "bun index.ts"}}`
3. `bun dev` - previously hung, now works

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-07 04:30:13 +00:00
..
2025-07-21 13:26:47 -07:00
2025-07-21 13:26:47 -07:00
2025-09-09 20:41:10 -07:00