From 3f33e8c47da28aef8855513359f723f55d002f33 Mon Sep 17 00:00:00 2001 From: Juergen Hoetzel Date: Mon, 11 Apr 2016 17:04:25 +0200 Subject: [PATCH] Use UTF-8 encoding for process output on Mono Fixes encoding issues when encoding property is not set: Refs #1212. This is a revised version of commit 2d63a45a8ab2479234856434c6ab5549b8880017, which broke external processes when standard error/output is not redirected: Refs #1213 This commit only sets the encoding when output is redirected. --- src/app/FakeLib/ProcessHelper.fs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/FakeLib/ProcessHelper.fs b/src/app/FakeLib/ProcessHelper.fs index 28b348a3d67..58cf1bbc614 100644 --- a/src/app/FakeLib/ProcessHelper.fs +++ b/src/app/FakeLib/ProcessHelper.fs @@ -7,6 +7,7 @@ open System.ComponentModel open System.Diagnostics open System.IO open System.Threading +open System.Text open System.Collections.Generic open System.ServiceProcess @@ -65,6 +66,9 @@ let ExecProcessWithLambdas configProcessStartInfoF (timeOut : TimeSpan) silent e if silent then proc.StartInfo.RedirectStandardOutput <- true proc.StartInfo.RedirectStandardError <- true + if isMono then + proc.StartInfo.StandardOutputEncoding <- Encoding.UTF8 + proc.StartInfo.StandardErrorEncoding <- Encoding.UTF8 proc.ErrorDataReceived.Add(fun d -> if d.Data <> null then errorF d.Data) proc.OutputDataReceived.Add(fun d ->