From fa86c89925d40d80f9478a154aa5ab8fa674338b Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Fri, 13 May 2016 11:29:09 -0700 Subject: [PATCH] Enable pre and post write in WriteToConsole --- .../host/msh/ConsoleHostUserInterface.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs index 2b9ed15127..a685772f3e 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs @@ -552,9 +552,8 @@ namespace Microsoft.PowerShell internal void WriteToConsole(string value, bool transcribeResult) { -#if OPEN - Console.Out.Write(value); -#else + +#if !OPEN ConsoleHandle handle = ConsoleControl.GetActiveScreenBufferHandle(); // Ensure that we're in the proper line-output mode. We don't lock here as it does not matter if we @@ -571,12 +570,16 @@ namespace Microsoft.PowerShell m |= desiredMode; ConsoleControl.SetMode(handle, m); } +#endif PreWrite(); // This is atomic, so we don't lock here... +#if !OPEN ConsoleControl.WriteConsole(handle, value); +#else + Console.Out.Write(value); #endif if (isInteractiveTestToolListening && Console.IsOutputRedirected)