authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-26 18:28:52-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-26 18:28:52-05:00
log51ac8eb08e7542c25c7d3a0d1ebeac040544e4c0
treee8a5ff930e22a73835eabf415174d927b9bae592
parent96e5f476c3f7f44d0b299bc6043f3fd88769bd8b

fix regression in windows stack traces tty detection


2 files changed, 5 insertions(+), 2 deletions(-)

lib/std/debug.zig+2-2
......@@ -81,7 +81,7 @@ pub fn getSelfDebugInfo() !*DebugInfo {
8181 }
8282}
8383
84fn detectTTYConfig() TTY.Config {
84pub fn detectTTYConfig() TTY.Config {
8585 var bytes: [128]u8 = undefined;
8686 const allocator = &std.heap.FixedBufferAllocator.init(bytes[0..]).allocator;
8787 if (process.getEnvVarOwned(allocator, "ZIG_DEBUG_COLOR")) |_| {
......@@ -89,7 +89,7 @@ fn detectTTYConfig() TTY.Config {
8989 } else |_| {
9090 if (stderr_file.supportsAnsiEscapeCodes()) {
9191 return .escape_codes;
92 } else if (builtin.os == .windows) {
92 } else if (builtin.os == .windows and stderr_file.isTty()) {
9393 return .windows_api;
9494 } else {
9595 return .no_color;
test/tests.zig+3
......@@ -622,6 +622,9 @@ pub const StackTracesContext = struct {
622622 child.stderr_behavior = .Pipe;
623623 child.env_map = b.env_map;
624624
625 if (b.verbose) {
626 printInvocation(args.toSliceConst());
627 }
625628 child.spawn() catch |err| debug.panic("Unable to spawn {}: {}\n", .{ full_exe_path, @errorName(err) });
626629
627630 var stdout = Buffer.initNull(b.allocator);