commit 7cf8cdd083142b6c85483fb78752dbf2f1ce6033
parent dec4f06381ec2da5c903074719e8d2f0322db522
Author: Drew DeVault <sir@cmpwn.com>
Date: Thu, 18 Mar 2021 11:31:16 -0400
os: buffer stdout
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/os/+linux/stdfd.ha b/os/+linux/stdfd.ha
@@ -7,7 +7,6 @@ let static_stderr_fd: fd_stream = fd_stream { ... };
let static_stdin_bufio: bufio::bufstream = bufio::bufstream { ... };
let static_stdout_bufio: bufio::bufstream = bufio::bufstream { ... };
-let static_stderr_bufio: bufio::bufstream = bufio::bufstream { ... };
@init fn init_stdfd() void = {
stdin = static_fdopen(0, "<stdin>", io::mode::READ, &static_stdin_fd);
@@ -16,4 +15,12 @@ let static_stderr_bufio: bufio::bufstream = bufio::bufstream { ... };
static let stdinbuf: [4096]u8 = [0...];
stdin = bufio::static_buffered(stdin, stdinbuf, [], &static_stdin_bufio);
+
+ static let stdoutbuf: [4096]u8 = [0...];
+ stdout = bufio::static_buffered(stdout, [], stdoutbuf, &static_stdout_bufio);
+};
+
+@fini fn fini_stdfd() void = {
+ // Flush any pending writes
+ io::close(stdout);
};