fix regression in windows stack traces tty detection

This commit is contained in:
Andrew Kelley 2020-01-26 18:28:52 -05:00
parent 96e5f476c3
commit 51ac8eb08e
2 changed files with 5 additions and 2 deletions

View File

@ -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;

View File

@ -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);