this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

panic: move recovery log to separate function

Move the recovery logic to a separate function so users of the library
may call it *without* using the default panic handler.

Reference: https://github.com/rockorager/libvaxis/discussions/146

+6 -2
+6 -2
src/main.zig
··· 49 49 50 50 /// Resets terminal state on a panic, then calls the default zig panic handler 51 51 pub fn panic_handler(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, ret_addr: ?usize) noreturn { 52 + recover(); 53 + std.builtin.default_panic(msg, error_return_trace, ret_addr); 54 + } 55 + 56 + /// Resets the terminal state using the global tty instance. Use this only to recover during a panic 57 + pub fn recover() void { 52 58 if (tty.global_tty) |gty| { 53 59 const reset: []const u8 = ctlseqs.csi_u_pop ++ 54 60 ctlseqs.mouse_reset ++ ··· 59 65 60 66 gty.deinit(); 61 67 } 62 - 63 - std.builtin.default_panic(msg, error_return_trace, ret_addr); 64 68 } 65 69 66 70 pub const log_scopes = enum {