Adding all code pages for dotnet CLI.
Since we write to the console and create new processes and read from their stdout and stderr, we need to ensure we have all the code pages in our process. This way we can encode/decode strings correctly when writing to our Console, and when reading from spawned process's output. Fix #2486
This commit is contained in:
parent
55e561bfb3
commit
5c8ef57585
1 changed files with 10 additions and 0 deletions
|
@ -5,6 +5,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.ProjectModel.Server;
|
||||
using Microsoft.DotNet.Tools.Build;
|
||||
|
@ -41,6 +42,8 @@ namespace Microsoft.DotNet.Cli
|
|||
{
|
||||
DebugHelper.HandleDebugSwitch(ref args);
|
||||
|
||||
InitializeProcess();
|
||||
|
||||
try
|
||||
{
|
||||
return Program.ProcessArgs(args, new Telemetry());
|
||||
|
@ -138,6 +141,13 @@ namespace Microsoft.DotNet.Cli
|
|||
|
||||
}
|
||||
|
||||
private static void InitializeProcess()
|
||||
{
|
||||
// by default, .NET Core doesn't have all code pages needed for Console apps.
|
||||
// see the .NET Core Notes in https://msdn.microsoft.com/en-us/library/system.diagnostics.process(v=vs.110).aspx
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
}
|
||||
|
||||
internal static bool TryGetBuiltInCommand(string commandName, out Func<string[], int> builtInCommand)
|
||||
{
|
||||
return s_builtIns.TryGetValue(commandName, out builtInCommand);
|
||||
|
|
Loading…
Reference in a new issue