update zig

This commit is contained in:
Mitchell Hashimoto
2023-10-24 15:00:10 -07:00
parent aee05d9e99
commit 7a1c54ad05
4 changed files with 15 additions and 15 deletions

View File

@@ -19,19 +19,19 @@ branch: []const u8,
pub fn detect(b: *std.Build) !Version {
// Execute a bunch of git commands to determine the automatic version.
var code: u8 = 0;
const branch = try b.execAllowFail(&[_][]const u8{ "git", "-C", b.build_root.path orelse ".", "rev-parse", "--abbrev-ref", "HEAD" }, &code, .Ignore);
const branch = try b.runAllowFail(&[_][]const u8{ "git", "-C", b.build_root.path orelse ".", "rev-parse", "--abbrev-ref", "HEAD" }, &code, .Ignore);
const short_hash = short_hash: {
const output = try b.execAllowFail(&[_][]const u8{ "git", "-C", b.build_root.path orelse ".", "log", "--pretty=format:%h", "-n", "1" }, &code, .Ignore);
const output = try b.runAllowFail(&[_][]const u8{ "git", "-C", b.build_root.path orelse ".", "log", "--pretty=format:%h", "-n", "1" }, &code, .Ignore);
break :short_hash std.mem.trimRight(u8, output, "\r\n ");
};
const tag = b.execAllowFail(&[_][]const u8{ "git", "-C", b.build_root.path orelse ".", "describe", "--exact-match", "--tags" }, &code, .Ignore) catch |err| switch (err) {
const tag = b.runAllowFail(&[_][]const u8{ "git", "-C", b.build_root.path orelse ".", "describe", "--exact-match", "--tags" }, &code, .Ignore) catch |err| switch (err) {
error.ExitCodeFailure => "", // expected
else => return err,
};
_ = b.execAllowFail(&[_][]const u8{
_ = b.runAllowFail(&[_][]const u8{
"git",
"-C",
b.build_root.path orelse ".",

View File

@@ -33,7 +33,7 @@ fn homeUnix(buf: []u8) !?[]u8 {
// If we're on darwin, we try the directory service. I'm not sure if there
// is a Mac API to do this but if so we can link to that...
if (builtin.os.tag == .macos) {
const exec = try std.ChildProcess.exec(.{
const run = try std.ChildProcess.run(.{
.allocator = fba.allocator(),
.argv = &[_][]const u8{
"/bin/sh",
@@ -43,8 +43,8 @@ fn homeUnix(buf: []u8) !?[]u8 {
.max_output_bytes = fba.buffer.len / 2,
});
if (exec.term == .Exited and exec.term.Exited == 0) {
const result = trimSpace(exec.stdout);
if (run.term == .Exited and run.term.Exited == 0) {
const result = trimSpace(run.stdout);
if (buf.len < result.len) return Error.BufferTooSmall;
std.mem.copy(u8, buf, result);
return buf[0..result.len];
@@ -62,14 +62,14 @@ fn homeUnix(buf: []u8) !?[]u8 {
// If all else fails, have the shell tell us...
fba.reset();
const exec = try std.ChildProcess.exec(.{
const run = try std.ChildProcess.run(.{
.allocator = fba.allocator(),
.argv = &[_][]const u8{ "/bin/sh", "-c", "cd && pwd" },
.max_output_bytes = fba.buffer.len / 2,
});
if (exec.term == .Exited and exec.term.Exited == 0) {
const result = trimSpace(exec.stdout);
if (run.term == .Exited and run.term.Exited == 0) {
const result = trimSpace(run.stdout);
if (buf.len < result.len) return Error.BufferTooSmall;
std.mem.copy(u8, buf, result);
return buf[0..result.len];