diff options
| author | Rohan Jadav <53231277+herohiralal@users.noreply.github.com> | 2025-04-27 01:58:37 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-27 01:58:37 +0530 |
| commit | 80a6f8928ada330601558eda35e576db4ce86d81 (patch) | |
| tree | e04a0ec21a06d1b793b2e5fb93ea02e17dcb94f8 | |
| parent | 6c1a3c4f0c790b8b79924827eb1d49c08aaa083f (diff) | |
fix: Pipe size on windows.
| -rw-r--r-- | core/os/os2/file_windows.odin | 9 |
1 files changed, 7 insertions, 2 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 + handle := _handle(&f.file) if f.kind == .Pipe { - return 0, .No_Size + bytesAvail: u32 + if win32.PeekNamedPipe(handle, nil, 0, nil, &bytesAvail, nil) { + return i64(bytesAvail), nil + } else { + return 0, .No_Size + } } - handle := _handle(&f.file) if !win32.GetFileSizeEx(handle, &length) { err = _get_platform_error() } |