From 80a6f8928ada330601558eda35e576db4ce86d81 Mon Sep 17 00:00:00 2001 From: Rohan Jadav <53231277+herohiralal@users.noreply.github.com> Date: Sun, 27 Apr 2025 01:58:37 +0530 Subject: [PATCH] fix: Pipe size on windows. --- core/os/os2/file_windows.odin | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/os/os2/file_windows.odin b/core/os/os2/file_windows.odin index b123330e0..390affd82 100644 --- a/core/os/os2/file_windows.odin +++ b/core/os/os2/file_windows.odin @@ -506,10 +506,15 @@ _write_at :: proc(f: ^File_Impl, p: []byte, offset: i64) -> (n: i64, err: Error) _file_size :: proc(f: ^File_Impl) -> (n: i64, err: Error) { length: win32.LARGE_INTEGER - if f.kind == .Pipe { - return 0, .No_Size - } handle := _handle(&f.file) + if f.kind == .Pipe { + bytesAvail: u32 + if win32.PeekNamedPipe(handle, nil, 0, nil, &bytesAvail, nil) { + return i64(bytesAvail), nil + } else { + return 0, .No_Size + } + } if !win32.GetFileSizeEx(handle, &length) { err = _get_platform_error() }