From 7c4c5495bebcb9cbd581b8198d51d13d8b7d7a8d Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 9 Apr 2021 10:34:10 -0700 Subject: [PATCH] stage2: fix stderr deadlock and slightly wrong tty coloring --- src/Compilation.zig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Compilation.zig b/src/Compilation.zig index 28a9b58556..b4d957e8d8 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -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 }); }, } }