aboutsummaryrefslogtreecommitdiff
path: root/std/io.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-10-09 16:31:03 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-10-10 19:36:35 -0400
commit1f28d641c054b8abd3eca914df6dde3ee7866ea3 (patch)
tree9d21fecb9bf74de15cc2422607dfc326c43a8b70 /std/io.zig
parentaa78827db2931d5affa13c5612f821e1328ec5ac (diff)
downloadzig-1f28d641c054b8abd3eca914df6dde3ee7866ea3.tar.gz
zig-1f28d641c054b8abd3eca914df6dde3ee7866ea3.zip
fix std.io.OutStream.close for windows
Diffstat (limited to 'std/io.zig')
-rw-r--r--std/io.zig14
1 files changed, 10 insertions, 4 deletions
diff --git a/std/io.zig b/std/io.zig
index 72cc85e437..3774abb49b 100644
--- a/std/io.zig
+++ b/std/io.zig
@@ -107,7 +107,7 @@ pub const OutStream = struct {
} else if (is_windows) {
@compileError("TODO: windows OutStream.openMode");
} else {
- @compileError("Unsupported OS");
+ unreachable;
}
}
@@ -174,8 +174,14 @@ pub const OutStream = struct {
}
pub fn close(self: &OutStream) {
- assert(self.index == 0);
- os.posixClose(self.fd);
+ assert(self.index == 0); // unflushed buffer
+ if (is_posix) {
+ os.posixClose(self.fd);
+ } else if (is_windows) {
+ os.windowsClose(%%self.getHandle());
+ } else {
+ unreachable;
+ }
}
pub fn isTty(self: &OutStream) -> %bool {
@@ -188,7 +194,7 @@ pub const OutStream = struct {
} else if (is_windows) {
return os.windowsIsTty(%return self.getHandle());
} else {
- @compileError("Unsupported OS");
+ unreachable;
}
}