Skip to content

Commit

Permalink
Use UTF-8 encoding for process output on Mono
Browse files Browse the repository at this point in the history
Fixes encoding issues when encoding property is not set: Refs fsprojects#1212.

This is a revised version of commit 2d63a45,
which broke external processes when standard error/output is not redirected: Refs fsprojects#1213

This commit only sets the encoding when output is redirected.
  • Loading branch information
juergenhoetzel committed Apr 11, 2016
1 parent f35b705 commit 3f33e8c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app/FakeLib/ProcessHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 ->
Expand Down

0 comments on commit 3f33e8c

Please sign in to comment.