Switch to using OS pipes

This commit is contained in:
2019-12-07 21:26:59 +00:00
parent 325ec9d591
commit ea094368e7
3 changed files with 73 additions and 48 deletions

View File

@@ -18,16 +18,12 @@ pub fn main() anyerror!void {
try m1.run();
var out: i32 = 0;
while (m1.readFromOutput(false)) |item| {
out = item;
} else |err| {
std.debug.assert(err == std.os.ReadError.WouldBlock);
}
while (out == 0) : (out = try m1.readFromOutput()) {}
std.debug.warn("Day 5, Part 1: {}\n", out);
try m2.writeToInput(5); // Thermal radiator controller
try m2.run();
std.debug.warn("Day 5, Part 2: {}\n", try m2.readFromOutput(false));
std.debug.warn("Day 5, Part 2: {}\n", try m2.readFromOutput());
}