Skip to content

Commit 6a4b444

Browse files
committed
Windows: Increase a pipe's buffer capacity to 64kb
This brings it inline with typical Linux defaults: https://www.man7.org/linux/man-pages/man7/pipe.7.html
1 parent dd38eea commit 6a4b444

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

library/std/src/sys/windows/pipe.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ pub struct Pipes {
5353
/// with `OVERLAPPED` instances, but also works out ok if it's only ever used
5454
/// once at a time (which we do indeed guarantee).
5555
pub fn anon_pipe(ours_readable: bool, their_handle_inheritable: bool) -> io::Result<Pipes> {
56+
// A 64kb pipe capacity is the same as a typical Linux default.
57+
const PIPE_BUFFER_CAPACITY: u32 = 64 * 1024;
58+
5659
// Note that we specifically do *not* use `CreatePipe` here because
5760
// unfortunately the anonymous pipes returned do not support overlapped
5861
// operations. Instead, we create a "hopefully unique" name and create a
@@ -91,8 +94,8 @@ pub fn anon_pipe(ours_readable: bool, their_handle_inheritable: bool) -> io::Res
9194
| c::PIPE_WAIT
9295
| reject_remote_clients_flag,
9396
1,
94-
4096,
95-
4096,
97+
PIPE_BUFFER_CAPACITY,
98+
PIPE_BUFFER_CAPACITY,
9699
0,
97100
ptr::null_mut(),
98101
);

0 commit comments

Comments
 (0)