From 4fe609e4c6a4031720d784c4e787d3506f6d87e7 Mon Sep 17 00:00:00 2001 From: Techatrix <19954306+Techatrix@users.noreply.github.com> Date: Fri, 2 Sep 2022 22:21:55 +0200 Subject: [PATCH] fallback when failing to run git describe --- build.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build.zig b/build.zig index 2e214a9..71aa15b 100644 --- a/build.zig +++ b/build.zig @@ -48,9 +48,10 @@ pub fn build(b: *std.build.Builder) !void { const version = v: { const version_string = b.fmt("{d}.{d}.{d}", .{ zls_version.major, zls_version.minor, zls_version.patch }); - const git_describe_untrimmed = try b.exec(&[_][]const u8{ + var code: u8 = undefined; + const git_describe_untrimmed = b.execAllowFail(&[_][]const u8{ "git", "-C", b.build_root, "describe", "--match", "*.*.*", "--tags", - }); + }, &code, .Ignore) catch break :v version_string; const git_describe = std.mem.trim(u8, git_describe_untrimmed, " \n\r");