Skip to content

Commit

Permalink
Fix for issue #1355 : System.ArgumentNullException thrown for colored…
Browse files Browse the repository at this point in the history
… console output on Mono
  • Loading branch information
Dzoukr committed Aug 22, 2016
1 parent 934dc83 commit 38726dd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app/FAKE/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ let printEnvironment cmdArgs args =
traceFAKE "FSI-Path: %s" fsiPath
traceFAKE "MSBuild-Path: %s" msBuildExe

let hostBasedEnvArgs = seq { if isMono then yield "term", "xterm-256color" } // avoid problem with unsupported colored terminal output

let containsParam param = Seq.map toLower >> Seq.exists ((=) (toLower param))

let paramIsHelp param = containsParam param ["help"; "?"; "/?"; "-h"; "--help"; "/h"; "/help"]
Expand Down Expand Up @@ -87,6 +89,7 @@ try
yield! fakeArgs.GetResults <@ Cli.EnvVar @>
if fakeArgs.Contains <@ Cli.Single_Target @> then yield "single-target", "true"
if args.Target.IsSome then yield "target", args.Target.Value }
|> Seq.append hostBasedEnvArgs

//Get our fsiargs from somewhere!
let fsiArgs =
Expand Down Expand Up @@ -134,7 +137,7 @@ try
let buildScriptArg = if cmdArgs.Length > 1 && cmdArgs.[1].EndsWith ".fsx" then cmdArgs.[1] else Seq.head buildScripts
let fakeArgs = cmdArgs |> Array.filter (fun x -> x.StartsWith "-d:" = false)
let fsiArgs = cmdArgs |> Array.filter (fun x -> x.StartsWith "-d:") |> Array.toList
let args = CommandlineParams.parseArgs (fakeArgs |> Seq.filter ((<>) buildScriptArg) |> Seq.filter ((<>) "details"))
let args = Seq.toList hostBasedEnvArgs @ CommandlineParams.parseArgs (fakeArgs |> Seq.filter ((<>) buildScriptArg) |> Seq.filter ((<>) "details"))

traceStartBuild()
let printDetails = containsParam "details" cmdArgs
Expand Down

0 comments on commit 38726dd

Please sign in to comment.