|
|
|
@ -48,8 +48,10 @@ pub const Diagnostics = struct { |
|
|
|
|
if (diag) |d| { |
|
|
|
|
var msg = e.getMessage(); |
|
|
|
|
defer msg.deinit(); |
|
|
|
|
// If the message ends with NUL byte, don't include it. |
|
|
|
|
const size = if (msg.data[msg.size - 1] == 0) msg.size - 1 else msg.size; |
|
|
|
|
d.data = .{ .err = e.getExitStatus() }; |
|
|
|
|
d.message = try d.allocator.alloc(u8, msg.size); |
|
|
|
|
d.message = try d.allocator.alloc(u8, size); |
|
|
|
|
@memcpy(@constCast(d.message.?), msg.data); |
|
|
|
|
if (d.debug_print) std.debug.print("{s}\n", .{d.message.?}); |
|
|
|
|
} |
|
|
|
@ -71,8 +73,10 @@ pub const Diagnostics = struct { |
|
|
|
|
if (diag) |d| { |
|
|
|
|
var msg = t.getMessage(); |
|
|
|
|
defer msg.deinit(); |
|
|
|
|
// If the message ends with NUL byte, don't include it. |
|
|
|
|
const size = if (msg.data[msg.size - 1] == 0) msg.size - 1 else msg.size; |
|
|
|
|
d.data = .{ .trap = code }; |
|
|
|
|
d.message = try d.allocator.alloc(u8, msg.size); |
|
|
|
|
d.message = try d.allocator.alloc(u8, size); |
|
|
|
|
@memcpy(@constCast(d.message.?), msg.data); |
|
|
|
|
if (d.debug_print) std.debug.print("{s}\n", .{d.message.?}); |
|
|
|
|
} |
|
|
|
|