diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 75d2afb8e9..857fe9223f 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -81,7 +81,7 @@ pub fn getSelfDebugInfo() !*DebugInfo { } } -fn detectTTYConfig() TTY.Config { +pub fn detectTTYConfig() TTY.Config { var bytes: [128]u8 = undefined; const allocator = &std.heap.FixedBufferAllocator.init(bytes[0..]).allocator; if (process.getEnvVarOwned(allocator, "ZIG_DEBUG_COLOR")) |_| { @@ -89,7 +89,7 @@ fn detectTTYConfig() TTY.Config { } else |_| { if (stderr_file.supportsAnsiEscapeCodes()) { return .escape_codes; - } else if (builtin.os == .windows) { + } else if (builtin.os == .windows and stderr_file.isTty()) { return .windows_api; } else { return .no_color; diff --git a/test/tests.zig b/test/tests.zig index 4d1f15fe29..f079b4664c 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -622,6 +622,9 @@ pub const StackTracesContext = struct { child.stderr_behavior = .Pipe; child.env_map = b.env_map; + if (b.verbose) { + printInvocation(args.toSliceConst()); + } child.spawn() catch |err| debug.panic("Unable to spawn {}: {}\n", .{ full_exe_path, @errorName(err) }); var stdout = Buffer.initNull(b.allocator);