Dylan Conway
d2b37a575f
Fix poll fd bug where stderr fd was incorrectly set to stdout fd ( #22091 )
...
## Summary
Fixes a bug in the internal `bun.spawnSync` implementation where
stderr's poll file descriptor was incorrectly set to stdout's fd when
polling both streams.
## The Bug
In `/src/bun.js/api/bun/process.zig` line 2204, when setting up the poll
file descriptor array for stderr, the code incorrectly used
`out_fds_to_wait_for[0]` (stdout) instead of `out_fds_to_wait_for[1]`
(stderr).
This meant:
- stderr's fd was never actually polled
- stdout's fd was polled twice
- Could cause stderr data to be lost or incomplete
- Could potentially cause hangs when reading from stderr
## Impact
This bug only affects Bun's internal CLI commands that use
`bun.spawnSync` with both stdout and stderr piped (like `bun create`,
`bun upgrade`, etc.). The JavaScript `spawnSync` API uses a different
code path and is not affected.
## The Fix
Changed line 2204 from:
```zig
poll_fds[poll_fds.len - 1].fd = @intCast(out_fds_to_wait_for[0].cast());
```
to:
```zig
poll_fds[poll_fds.len - 1].fd = @intCast(out_fds_to_wait_for[1].cast());
```
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-authored-by: Claude <noreply@anthropic.com >
2025-08-24 03:16:22 -07:00
..
2025-08-22 23:04:58 -07:00
2025-07-22 17:51:38 -07:00
2025-08-23 06:55:30 -07:00
2025-08-20 16:16:11 -07:00
2025-08-11 20:19:34 -07:00
2025-08-23 06:55:30 -07:00
2025-07-22 17:51:38 -07:00
2025-08-24 03:16:22 -07:00
2025-08-23 06:55:30 -07:00
2025-08-23 00:33:24 -07:00
2025-08-20 00:25:00 -07:00
2025-08-11 13:29:53 -07:00
2025-07-25 12:38:06 -07:00
2025-08-15 20:59:50 -07:00
2025-08-14 16:00:03 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-08-11 20:19:34 -07:00
2025-08-23 06:55:30 -07:00
2025-07-17 03:13:48 -07:00
2025-08-21 14:53:50 -07:00
2025-08-23 06:55:30 -07:00
2025-08-14 18:03:26 -07:00
2025-08-23 15:12:09 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-08-12 19:59:34 -07:00
2025-07-31 22:07:17 -07:00
2025-08-11 20:19:34 -07:00
2025-08-22 23:04:58 -07:00
2025-08-14 11:58:37 -07:00
2025-08-11 20:19:34 -07:00
2025-08-22 23:04:58 -07:00
2025-07-23 17:10:58 -07:00
2025-08-20 16:16:11 -07:00
2025-08-11 20:19:34 -07:00
2025-08-21 15:28:15 -07:00
2025-08-23 06:55:30 -07:00
2025-08-04 13:07:42 -07:00
2025-07-21 13:26:47 -07:00
2025-08-11 13:40:07 -07:00
2025-08-22 12:08:42 -07:00
2025-06-04 19:41:26 -07:00
2025-08-11 20:19:34 -07:00
2025-08-15 19:05:25 -07:00
2025-08-23 06:55:30 -07:00
2025-05-14 18:42:42 -07:00
2025-07-29 19:35:46 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-08-07 15:16:44 -07:00
2025-04-17 14:17:08 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-20 23:04:17 -07:00
2025-08-23 06:57:00 -07:00
2025-08-15 22:28:42 -07:00
2025-08-21 14:53:50 -07:00
2025-06-12 14:20:28 -07:00
2025-08-11 20:19:34 -07:00
2025-07-21 13:26:47 -07:00
2025-08-23 19:49:01 -07:00
2025-07-22 17:51:38 -07:00
2025-08-20 01:25:49 -07:00
2025-07-31 00:56:50 -07:00
2025-08-11 20:19:34 -07:00
2025-08-21 18:52:17 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-08-07 15:16:44 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-07-28 00:13:17 -07:00
2025-08-22 23:04:58 -07:00
2025-05-08 23:22:16 -07:00
2025-05-08 23:22:16 -07:00
2025-08-14 18:03:26 -07:00
2025-07-25 16:22:04 -07:00
2025-05-08 23:22:16 -07:00
2025-08-21 15:28:15 -07:00
2025-08-11 20:19:34 -07:00
2025-08-23 06:55:30 -07:00
2025-06-03 23:51:03 -07:00
2025-08-01 23:38:34 -07:00
2025-08-15 19:05:25 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-08-11 20:19:34 -07:00
2025-08-15 17:51:35 -07:00
2025-07-09 00:19:57 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-08-23 06:55:30 -07:00
2025-07-22 17:51:38 -07:00
2025-08-19 18:47:04 -07:00
2025-08-05 20:52:16 -07:00
2025-08-23 06:55:30 -07:00
2025-07-21 13:26:47 -07:00
2025-03-26 23:57:10 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-08-14 21:12:22 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-08-11 13:40:07 -07:00
2025-07-22 17:51:38 -07:00
2025-08-22 23:04:58 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-08-23 06:55:30 -07:00
2025-08-18 20:02:08 -07:00
2025-07-22 17:51:38 -07:00
2025-08-11 20:19:34 -07:00
2025-07-21 13:26:47 -07:00
2025-07-21 13:26:47 -07:00
2025-07-21 13:26:47 -07:00
2025-07-21 13:26:47 -07:00
2025-07-21 13:26:47 -07:00
2025-08-22 23:04:58 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-06-22 20:51:45 -07:00
2025-07-22 17:51:38 -07:00
2025-08-11 13:40:07 -07:00
2025-07-21 13:26:47 -07:00
2025-08-23 06:55:30 -07:00
2025-07-21 13:26:47 -07:00
2025-08-08 18:02:19 -07:00
2025-07-13 04:27:43 -07:00
2025-07-13 04:27:43 -07:00
2025-07-13 04:27:43 -07:00
2025-07-25 12:38:06 -07:00
2025-08-14 18:03:26 -07:00
2025-07-21 13:26:47 -07:00
2025-08-04 19:21:28 -07:00
2025-07-25 12:38:06 -07:00
2025-07-21 13:26:47 -07:00
2025-08-23 06:55:30 -07:00
2025-05-08 23:22:16 -07:00
2025-07-21 13:26:47 -07:00
2025-08-11 20:19:34 -07:00
2025-07-21 13:26:47 -07:00
2025-07-21 13:26:47 -07:00
2025-08-11 20:19:34 -07:00
2025-07-22 17:51:38 -07:00
2025-08-11 20:19:34 -07:00
2025-07-20 23:04:17 -07:00
2025-08-23 06:55:30 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00