Zig 0.15: zig build test macOS

pull/9004/head
Mitchell Hashimoto 2025-10-02 15:31:11 -07:00
parent d59d754e29
commit 0112607532
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
4 changed files with 25 additions and 20 deletions

View File

@ -32,10 +32,11 @@ pub const Log = opaque {
comptime format: []const u8,
args: anytype,
) void {
const str = nosuspend std.fmt.allocPrintZ(
const str = nosuspend std.fmt.allocPrintSentinel(
alloc,
format,
args,
0,
) catch return;
defer alloc.free(str);
zig_os_log_with_type(self, typ, str.ptr);

View File

@ -266,8 +266,8 @@ pub const App = struct {
// embedded apprt.
self.performPreAction(target, action, value);
log.debug("dispatching action target={s} action={} value={}", .{
@tagName(target),
log.debug("dispatching action target={t} action={} value={any}", .{
target,
action,
value,
});
@ -1910,7 +1910,7 @@ pub const CAPI = struct {
};
return ptr.core_surface.performBindingAction(action) catch |err| {
log.err("error performing binding action action={} err={}", .{ action, err });
log.err("error performing binding action action={f} err={}", .{ action, err });
return false;
};
}

View File

@ -265,8 +265,8 @@ pub const Transport = struct {
const json = envelope.serialize();
defer sentry.free(@ptrCast(json.ptr));
var parsed: crash.Envelope = parsed: {
var fbs = std.io.fixedBufferStream(json);
break :parsed try crash.Envelope.parse(alloc, fbs.reader());
var reader: std.Io.Reader = .fixed(json);
break :parsed try crash.Envelope.parse(alloc, &reader);
};
defer parsed.deinit();
@ -298,7 +298,10 @@ pub const Transport = struct {
});
const file = try std.fs.cwd().createFile(path, .{});
defer file.close();
try file.writer().writeAll(json);
var buf: [4096]u8 = undefined;
var file_writer = file.writer(&buf);
try file_writer.interface.writeAll(json);
try file_writer.end();
log.warn("crash report written to disk path={s}", .{path});
}

View File

@ -1440,7 +1440,7 @@ fn execCommand(
// grow if necessary for a longer command (uncommon).
9,
);
defer args.deinit();
defer args.deinit(alloc);
// The reason for executing login this way is unclear. This
// comment will attempt to explain but prepare for a truly
@ -1487,40 +1487,41 @@ fn execCommand(
// macOS.
//
// Awesome.
try args.append("/usr/bin/login");
if (hush) try args.append("-q");
try args.append("-flp");
try args.append(username);
try args.append(alloc, "/usr/bin/login");
if (hush) try args.append(alloc, "-q");
try args.append(alloc, "-flp");
try args.append(alloc, username);
switch (command) {
// Direct args can be passed directly to login, since
// login uses execvp we don't need to worry about PATH
// searching.
.direct => |v| try args.appendSlice(v),
.direct => |v| try args.appendSlice(alloc, v),
.shell => |v| {
// Use "exec" to replace the bash process with
// our intended command so we don't have a parent
// process hanging around.
const cmd = try std.fmt.allocPrintZ(
const cmd = try std.fmt.allocPrintSentinel(
alloc,
"exec -l {s}",
.{v},
0,
);
// We execute bash with "--noprofile --norc" so that it doesn't
// load startup files so that (1) our shell integration doesn't
// break and (2) user configuration doesn't mess this process
// up.
try args.append("/bin/bash");
try args.append("--noprofile");
try args.append("--norc");
try args.append("-c");
try args.append(cmd);
try args.append(alloc, "/bin/bash");
try args.append(alloc, "--noprofile");
try args.append(alloc, "--norc");
try args.append(alloc, "-c");
try args.append(alloc, cmd);
},
}
return try args.toOwnedSlice();
return try args.toOwnedSlice(alloc);
}
return switch (command) {