diff options
Diffstat (limited to 'src/macos.zig')
| -rw-r--r-- | src/macos.zig | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/macos.zig b/src/macos.zig index 4c7eb97f..a9c9d0f3 100644 --- a/src/macos.zig +++ b/src/macos.zig @@ -41,6 +41,19 @@ const lsp_host = @import("lsp_host.zig"); // the shared snapshot + worker body const host_api = @import("host.zig"); // LspRequest and the vtable's own types const tracy = @import("tracy.zig"); // no-op unless -Dtracy names a checkout const selection_pipe = @import("selection_pipe.zig"); // Job, runJob and Tasks +const crash = @import("crash.zig"); + +/// This file is the ROOT of the macOS build (build.zig: the AppKit shell is a +/// library whose host owns main()), so `std.builtin.panic` resolves here and +/// not in src/main.zig — a handler written only there would never run in the +/// app, which is the shell with the least useful stderr of the four. No +/// terminal to restore either, which is the rest of what main.zig's does. +pub const panic = std.debug.FullPanic(struct { + fn call(msg: []const u8, ret_addr: ?usize) noreturn { + crash.record(msg, ret_addr); + std.debug.defaultPanic(msg, ret_addr); + } +}.call); extern "c" fn setenv(name: [*:0]const u8, value: [*:0]const u8, overwrite: c_int) c_int; @@ -679,6 +692,10 @@ fn initCore(runtime: ?*const Runtime, cols_arg: u16, rows_arg: u16) !void { opts.startup_config = found.bytes; opts.startup_config_path = found.path; opts.config_dir = found.dir; + // This host has no terminal at all, so the panic trace stderr gets goes + // to a Console.app nobody has open. `panic` above writes it beside the + // init file too, and this is where it learns the directory. + if (found.dir) |d| crash.setDir(d); } pardes.image.start(io, allocs.image); |
