authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-09 10:34:10-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-09 10:34:10-07:00
log7c4c5495bebcb9cbd581b8198d51d13d8b7d7a8d
treeed1598e262b73683e62413480dc6d80fc95ee69e
parentf75cdd1acd0929792c33766bd1d093d897c65113

stage2: fix stderr deadlock and slightly wrong tty coloring


1 files changed, 4 insertions(+), 3 deletions(-)

src/Compilation.zig+4-3
......@@ -285,7 +285,7 @@ pub const AllErrors = struct {
285285 const held = std.debug.getStderrMutex().acquire();
286286 defer held.release();
287287 const stderr = std.io.getStdErr();
288 return msg.renderToStdErrInner(ttyconf, stderr, "error", .Red) catch return;
288 return msg.renderToStdErrInner(ttyconf, stderr, "error:", .Red) catch return;
289289 }
290290
291291 fn renderToStdErrInner(
......@@ -298,6 +298,7 @@ pub const AllErrors = struct {
298298 const stderr = stderr_file.writer();
299299 switch (msg) {
300300 .src => |src| {
301 ttyconf.setColor(stderr, .Bold);
301302 try stderr.print("{s}:{d}:{d}: ", .{
302303 src.src_path,
303304 src.line + 1,
......@@ -317,11 +318,11 @@ pub const AllErrors = struct {
317318 ttyconf.setColor(stderr, .Reset);
318319 }
319320 for (src.notes) |note| {
320 try note.renderToStdErrInner(ttyconf, stderr_file, "note", .Cyan);
321 try note.renderToStdErrInner(ttyconf, stderr_file, "note:", .Cyan);
321322 }
322323 },
323324 .plain => |plain| {
324 std.debug.print("{s}: {s}\n", .{ kind, plain.msg });
325 stderr.print("{s}: {s}\n", .{ kind, plain.msg });
325326 },
326327 }
327328 }