mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-12 17:08:39 -09:00
Add custom panic handler
Sadly, it doesn't seem to be called on segfaults, which means that will still output garbage. I could install a custom segfault handler, but not sure that's worth the effort.
This commit is contained in:
parent
30d6ddf149
commit
22dca22450
1 changed files with 8 additions and 0 deletions
|
|
@ -61,6 +61,14 @@ pub const allocator = std.mem.Allocator{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Custom panic impl to reset the terminal before spewing out an error message.
|
||||||
|
pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, ret_addr: ?usize) noreturn {
|
||||||
|
@setCold(true);
|
||||||
|
ui.deinit();
|
||||||
|
std.debug.panicImpl(error_return_trace, ret_addr orelse @returnAddress(), msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
pub const config = struct {
|
pub const config = struct {
|
||||||
pub const SortCol = enum { name, blocks, size, items, mtime };
|
pub const SortCol = enum { name, blocks, size, items, mtime };
|
||||||
pub const SortOrder = enum { asc, desc };
|
pub const SortOrder = enum { asc, desc };
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue