fix version checking
All checks were successful
Generic zig build / build (push) Successful in 1m27s
Generic zig build / deploy (push) Successful in 17s

This commit is contained in:
Emil Lerch 2026-10-26 16:14:40 -07:00
parent 5504f44747
commit 157cf44871
Signed by: lobo
GPG key ID: A7B62D657EF764F8

View file

@ -64,8 +64,11 @@ pub fn getVersion(b: *Build, options: Options) []const u8 {
fn findBuildRoot(allocator: std.mem.Allocator, io: std.Io) ![]const u8 { fn findBuildRoot(allocator: std.mem.Allocator, io: std.Io) ![]const u8 {
var buf: [std.fs.max_path_bytes]u8 = undefined; var buf: [std.fs.max_path_bytes]u8 = undefined;
// `realPath` now returns the length written rather than a slice. // Not `Dir.cwd().realPath`: on Linux that resolves the handle through
const start_len = try std.Io.Dir.cwd().realPath(io, &buf); // `/proc/self/fd/{fd}`, and `Dir.cwd()` is the `AT_FDCWD` sentinel (-100)
// rather than a real descriptor, so it always fails with `FileNotFound`.
// That silently turned every version string into "unknown".
const start_len = try std.process.currentPath(io, &buf);
var cwd: []const u8 = buf[0..start_len]; var cwd: []const u8 = buf[0..start_len];
while (true) { while (true) {