Skip to content

Commit 07929ce

Browse files
redirect Console.Out to stderr
Redirecting Console.Out to use the standard error stream to try reduce the chances of stdout being corrupted by non-rpc content.
1 parent 581baa0 commit 07929ce

File tree

1 file changed

+2
-0
lines changed
  • src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer

1 file changed

+2
-0
lines changed

src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ static async Task RunAsync(ServerConfiguration serverConfiguration, Cancellation
129129
if (serverConfiguration.UseStdIo)
130130
{
131131
server = new LanguageServerHost(Console.OpenStandardInput(), Console.OpenStandardOutput(), exportProvider, languageServerLogger, typeRefResolver);
132+
// Redirect Console.Out to try prevent the standard output stream from being corrupted.
133+
Console.SetOut(new StreamWriter(Console.OpenStandardError()));
132134
}
133135
else
134136
{

0 commit comments

Comments
 (0)