Skip to content

Commit da51e94

Browse files
committed
std.fs.File.end: account for streaming mode
1 parent 7f43f78 commit da51e94

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/std/fs/File.zig

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2026,7 +2026,16 @@ pub const Writer = struct {
20262026
/// along with other write failures.
20272027
pub fn end(w: *Writer) EndError!void {
20282028
try w.interface.flush();
2029-
return w.file.setEndPos(w.pos);
2029+
switch (w.mode) {
2030+
.positional,
2031+
.positional_reading,
2032+
=> try w.file.setEndPos(w.pos),
2033+
2034+
.streaming,
2035+
.streaming_reading,
2036+
.failure,
2037+
=> {},
2038+
}
20302039
}
20312040
};
20322041

0 commit comments

Comments
 (0)