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 issus on systems when encoding property is not set.
  • Loading branch information
juergenhoetzel committed Apr 10, 2016
1 parent b258452 commit 2d63a45
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 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 All @@ -15,9 +16,12 @@ let startedProcesses = HashSet()

/// [omit]
let start (proc : Process) =
if isMono && proc.StartInfo.FileName.ToLowerInvariant().EndsWith(".exe") then
proc.StartInfo.Arguments <- "--debug \"" + proc.StartInfo.FileName + "\" " + proc.StartInfo.Arguments
proc.StartInfo.FileName <- monoPath
if isMono then
proc.StartInfo.StandardOutputEncoding <- Encoding.UTF8
proc.StartInfo.StandardErrorEncoding <- Encoding.UTF8
if proc.StartInfo.FileName.ToLowerInvariant().EndsWith(".exe") then
proc.StartInfo.Arguments <- "--debug \"" + proc.StartInfo.FileName + "\" " + proc.StartInfo.Arguments
proc.StartInfo.FileName <- monoPath

proc.Start() |> ignore
startedProcesses.Add(proc.Id, proc.StartTime) |> ignore
Expand Down

0 comments on commit 2d63a45

Please sign in to comment.