I tried getting user input with std.io.getStdIn().reader().readUntilDelimiter(buffer, '\n') but it results in a build error that doesn't provide much help:
Build Summary: 2/5 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
└─ install Test transitive failure
└─ zig build-exe Test Debug native 1 errors
error: the following build command failed with exit code 1
I simplified the code to the bare minimum but it still presents the same bug:
const std = @import("std");
pub fn main() !void {
const stdin = std.io.getStdIn().reader();
const buffer: [1024]u8 = undefined;
_ = try stdin.readUntilDelimiter(buffer, '\n');
}
Doing anything else without the readUntilDelimiter works fine, it's just the input function that freaks out.
Since the error message provided no help, I tried uninstalling and reinstalling Zig, but that didn't help either. Any help would be greatly appreciated.
Edit:
It turns out the build fails just by calling std.io.getStdIn().reader(); without anything else.