From 3ff48effbfc234159e7de004cb827d48590cd177 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Mon, 28 Mar 2016 22:31:03 -0500 Subject: [PATCH] (GH-674)(GH-672) Color Overrides / Fix Write-Host Write-Host was double printing, but it appears that it was due to calling Write, and then an empty WriteLine, both of which the PoshHostUserInterface were calling a log entry which writes out each as a line. Instead log just to the file and print with `Console.Write` and `Console.WriteLine`. Using `Console` calls solves the issue of not seeing the colorization overrides, so those will be displayed properly. --- .../infrastructure/powershell/PoshHostUserInterface.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs b/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs index 2a0a20e695..6b7f6eb844 100644 --- a/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs +++ b/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs @@ -75,8 +75,8 @@ public override void Write(ConsoleColor foregroundColor, ConsoleColor background System.Console.ForegroundColor = foregroundColor; System.Console.BackgroundColor = backgroundColor; - //todo: this should console out and then log to the file without showing it - this.Log().Info(value.escape_curly_braces()); + Console.Write(value); + this.Log().Info(ChocolateyLoggers.LogFileOnly, value.escape_curly_braces()); System.Console.ForegroundColor = originalForegroundColor; System.Console.BackgroundColor = originalBackgroundColor; @@ -94,8 +94,8 @@ public override void WriteLine(ConsoleColor foregroundColor, ConsoleColor backgr System.Console.ForegroundColor = foregroundColor; System.Console.BackgroundColor = backgroundColor; - //todo: this should console out and then log to the file without showing it - this.Log().Info(value.escape_curly_braces()); + Console.WriteLine(value); + this.Log().Info(ChocolateyLoggers.LogFileOnly, value.escape_curly_braces()); System.Console.ForegroundColor = originalForegroundColor; System.Console.BackgroundColor = originalBackgroundColor;