diff options
| author | Sahnvour <sahnvour@pm.me> | 2023-08-13 11:25:48 +0200 |
|---|---|---|
| committer | Sahnvour <sahnvour@pm.me> | 2023-08-13 11:25:48 +0200 |
| commit | f43402f883bff6c1934c551b5cb29f70dac1b1b6 (patch) | |
| tree | 205f9c383a28ca96cde891a0d8f1370295282ca8 /lib/std/Build/Step.zig | |
| parent | 078e3305555f117efbaa83a91b2e79444847363c (diff) | |
| download | zig-f43402f883bff6c1934c551b5cb29f70dac1b1b6.tar.gz zig-f43402f883bff6c1934c551b5cb29f70dac1b1b6.zip | |
std.Build: factorize Step stack trace dumping code
Diffstat (limited to 'lib/std/Build/Step.zig')
| -rw-r--r-- | lib/std/Build/Step.zig | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/std/Build/Step.zig b/lib/std/Build/Step.zig index b421309eac..475fc82e1a 100644 --- a/lib/std/Build/Step.zig +++ b/lib/std/Build/Step.zig @@ -231,13 +231,9 @@ pub fn cast(step: *Step, comptime T: type) ?*T { } /// For debugging purposes, prints identifying information about this Step. -pub fn dump(step: *Step) void { - std.debug.getStderrMutex().lock(); - defer std.debug.getStderrMutex().unlock(); - - const stderr = std.io.getStdErr(); - const w = stderr.writer(); - const tty_config = std.io.tty.detectConfig(stderr); +pub fn dump(step: *Step, file: std.fs.File) void { + const w = file.writer(); + const tty_config = std.io.tty.detectConfig(file); const debug_info = std.debug.getSelfDebugInfo() catch |err| { w.print("Unable to dump stack trace: Unable to open debug info: {s}\n", .{ @errorName(err), @@ -248,7 +244,7 @@ pub fn dump(step: *Step) void { if (step.getStackTrace()) |stack_trace| { w.print("name: '{s}'. creation stack trace:\n", .{step.name}) catch {}; std.debug.writeStackTrace(stack_trace, w, ally, debug_info, tty_config) catch |err| { - stderr.writer().print("Unable to dump stack trace: {s}\n", .{@errorName(err)}) catch {}; + w.print("Unable to dump stack trace: {s}\n", .{@errorName(err)}) catch {}; return; }; } else { |
