Skip to content

Commit 790c94a

Browse files
committed
Update all stderr uses
1 parent b4497d5 commit 790c94a

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/MachO.zig

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3578,13 +3578,13 @@ pub fn getAllErrorsAlloc(self: *MachO) !ErrorBundle {
35783578
}
35793579

35803580
fn renderWarningToStdErr(eb: ErrorBundle) void {
3581-
std.debug.lockStdErr();
3582-
defer std.debug.unlockStdErr();
3583-
const stderr = std.io.getStdErr();
3584-
return renderWarningToWriter(eb, stderr.writer()) catch return;
3581+
var buffer: [256]u8 = undefined;
3582+
const w = std.debug.lockStderrWriter(&buffer);
3583+
defer std.debug.unlockStderrWriter();
3584+
return renderWarningToWriter(eb, w) catch return;
35853585
}
35863586

3587-
fn renderWarningToWriter(eb: ErrorBundle, writer: anytype) !void {
3587+
fn renderWarningToWriter(eb: ErrorBundle, writer: *Writer) !void {
35883588
for (eb.getMessages()) |msg| {
35893589
try renderWarningMessageToWriter(eb, msg, writer, "warning", .cyan, 0);
35903590
}
@@ -3593,12 +3593,12 @@ fn renderWarningToWriter(eb: ErrorBundle, writer: anytype) !void {
35933593
fn renderWarningMessageToWriter(
35943594
eb: ErrorBundle,
35953595
err_msg_index: ErrorBundle.MessageIndex,
3596-
stderr: anytype,
3596+
stderr: *Writer,
35973597
kind: []const u8,
35983598
color: std.io.tty.Color,
35993599
indent: usize,
36003600
) anyerror!void {
3601-
const ttyconf = std.io.tty.detectConfig(std.io.getStdErr());
3601+
const ttyconf = std.io.tty.detectConfig(std.fs.File.stderr());
36023602
const err_msg = eb.getErrorMessage(err_msg_index);
36033603
try ttyconf.setColor(stderr, color);
36043604
try stderr.writeByteNTimes(' ', indent);
@@ -3623,7 +3623,7 @@ pub fn reportErrors(self: *MachO) void {
36233623
var errors = self.getAllErrorsAlloc() catch @panic("OOM");
36243624
defer errors.deinit(self.allocator);
36253625
if (errors.errorMessageCount() > 0) {
3626-
errors.renderToStdErr(.{ .ttyconf = std.io.tty.detectConfig(std.io.getStdErr()) });
3626+
errors.renderToStdErr(.{ .ttyconf = std.io.tty.detectConfig(std.fs.File.stderr()) });
36273627
}
36283628
}
36293629

@@ -3692,3 +3692,4 @@ const TlvPtrSection = synthetic.TlvPtrSection;
36923692
const UnwindInfo = @import("UnwindInfo.zig");
36933693
const WaitGroup = std.Thread.WaitGroup;
36943694
const WeakBind = synthetic.WeakBind;
3695+
const Writer = std.Io.Writer;

src/main.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub const std_options: std.Options = .{ .logFn = logFn };
5555

5656
fn print(comptime format: []const u8, args: anytype) void {
5757
const msg = std.fmt.allocPrint(gpa, format, args) catch return;
58-
std.io.getStdErr().writeAll(msg) catch {};
58+
std.fs.File.stderr().writeAll(msg) catch {};
5959
}
6060

6161
fn fatal(comptime format: []const u8, args: anytype) noreturn {

0 commit comments

Comments
 (0)