aboutsummaryrefslogtreecommitdiff
path: root/std/std.zig
diff options
context:
space:
mode:
Diffstat (limited to 'std/std.zig')
-rw-r--r--std/std.zig24
1 files changed, 24 insertions, 0 deletions
diff --git a/std/std.zig b/std/std.zig
index 1333b5be39..5d1e7a78ca 100644
--- a/std/std.zig
+++ b/std/std.zig
@@ -121,6 +121,18 @@ pub struct OutStream {
}
}
}
+
+ pub fn close(os: &OutStream) -> %void {
+ const closed = close(os.fd);
+ if (closed < 0) {
+ return switch (-closed) {
+ EIO => error.Io,
+ EBADF => error.BadFd,
+ EINTR => error.SigInterrupt,
+ else => error.Unexpected,
+ }
+ }
+ }
}
pub struct InStream {
@@ -140,6 +152,18 @@ pub struct InStream {
}
return amt_read;
}
+
+ pub fn close(is: &InStream) -> %void {
+ const closed = close(is.fd);
+ if (closed < 0) {
+ return switch (-closed) {
+ EIO => error.Io,
+ EBADF => error.BadFd,
+ EINTR => error.SigInterrupt,
+ else => error.Unexpected,
+ }
+ }
+ }
}
#attribute("cold")