From 67f896ecb61b546682a6b2c579ebd03586a55926 Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Thu, 5 May 2022 14:00:59 +0800 Subject: [PATCH] Core.Process: only set StandardEncoding if output/err is redirected Should potentially fix https://github.com/fsprojects/FAKE/issues/2670 --- src/app/Fake.Core.Process/Process.fs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/Fake.Core.Process/Process.fs b/src/app/Fake.Core.Process/Process.fs index 6ab92e2cf87..79ff76a84b3 100644 --- a/src/app/Fake.Core.Process/Process.fs +++ b/src/app/Fake.Core.Process/Process.fs @@ -415,8 +415,10 @@ module Process = RawProc.createProcessStarter (fun (c:RawCreateProcess) (p:Process) -> let si = p.StartInfo if Environment.isMono || AlwaysSetProcessEncoding then - si.StandardOutputEncoding <- ProcessEncoding - si.StandardErrorEncoding <- ProcessEncoding + if si.RedirectStandardOutput then + si.StandardOutputEncoding <- ProcessEncoding + if si.RedirectStandardError then + si.StandardErrorEncoding <- ProcessEncoding if c.TraceCommand && shouldEnableProcessTracing() then let commandLine =