mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
stage2: fix stderr deadlock and slightly wrong tty coloring
This commit is contained in:
parent
f75cdd1acd
commit
7c4c5495be
@ -285,7 +285,7 @@ pub const AllErrors = struct {
|
||||
const held = std.debug.getStderrMutex().acquire();
|
||||
defer held.release();
|
||||
const stderr = std.io.getStdErr();
|
||||
return msg.renderToStdErrInner(ttyconf, stderr, "error", .Red) catch return;
|
||||
return msg.renderToStdErrInner(ttyconf, stderr, "error:", .Red) catch return;
|
||||
}
|
||||
|
||||
fn renderToStdErrInner(
|
||||
@ -298,6 +298,7 @@ pub const AllErrors = struct {
|
||||
const stderr = stderr_file.writer();
|
||||
switch (msg) {
|
||||
.src => |src| {
|
||||
ttyconf.setColor(stderr, .Bold);
|
||||
try stderr.print("{s}:{d}:{d}: ", .{
|
||||
src.src_path,
|
||||
src.line + 1,
|
||||
@ -317,11 +318,11 @@ pub const AllErrors = struct {
|
||||
ttyconf.setColor(stderr, .Reset);
|
||||
}
|
||||
for (src.notes) |note| {
|
||||
try note.renderToStdErrInner(ttyconf, stderr_file, "note", .Cyan);
|
||||
try note.renderToStdErrInner(ttyconf, stderr_file, "note:", .Cyan);
|
||||
}
|
||||
},
|
||||
.plain => |plain| {
|
||||
std.debug.print("{s}: {s}\n", .{ kind, plain.msg });
|
||||
stderr.print("{s}: {s}\n", .{ kind, plain.msg });
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user