summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig
index 56d04669..5275ea28 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -28,6 +28,16 @@ pub const panic = if (is_emscripten) std.debug.FullPanic(std.debug.defaultPanic)
}
}.call);
+// Fatal signals (SIGSEGV/SIGILL/SIGBUS/SIGFPE) bypass the panic handler and
+// no defer/errdefer ever runs — hook std.debug's segfault path the same way
+// so the terminal is restored before the trace prints.
+pub const debug = if (is_emscripten) struct {} else struct {
+ pub fn handleSegfault(addr: ?usize, name: []const u8, opt_ctx: anytype) noreturn {
+ @import("vaxis").recover();
+ return std.debug.defaultHandleSegfault(addr, name, opt_ctx);
+ }
+};
+
const help_text =
\\Usage: pardes [options]
\\