feat: make zig stack traces optional
This commit is contained in:
parent
fa72fb879c
commit
b82d735579
1 changed files with 4 additions and 0 deletions
|
@ -11,6 +11,8 @@ const c = @cImport({
|
||||||
const cbor = @import("cbor");
|
const cbor = @import("cbor");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
|
|
||||||
|
pub var stack_trace_on_errors: bool = false;
|
||||||
|
|
||||||
pub const subprocess = if (builtin.os.tag == .windows) @import("subprocess_windows.zig") else @import("subprocess.zig");
|
pub const subprocess = if (builtin.os.tag == .windows) @import("subprocess_windows.zig") else @import("subprocess.zig");
|
||||||
|
|
||||||
pub const install_debugger = c.install_debugger;
|
pub const install_debugger = c.install_debugger;
|
||||||
|
@ -204,6 +206,8 @@ pub const message = struct {
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn exit_message(e: anytype, stack_trace: ?*std.builtin.StackTrace) message {
|
pub fn exit_message(e: anytype, stack_trace: ?*std.builtin.StackTrace) message {
|
||||||
|
if (!stack_trace_on_errors)
|
||||||
|
return message.fmtbuf(&error_message_buffer, .{ "exit", e }) catch unreachable;
|
||||||
if (stack_trace) |stack_trace_| {
|
if (stack_trace) |stack_trace_| {
|
||||||
var debug_info_arena_allocator: std.heap.ArenaAllocator = std.heap.ArenaAllocator.init(std.heap.page_allocator);
|
var debug_info_arena_allocator: std.heap.ArenaAllocator = std.heap.ArenaAllocator.init(std.heap.page_allocator);
|
||||||
defer debug_info_arena_allocator.deinit();
|
defer debug_info_arena_allocator.deinit();
|
||||||
|
|
Loading…
Add table
Reference in a new issue