Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hint shown in for ArgumentException #1355 instead of trying to set it directly #1366

Merged
merged 1 commit into from
Aug 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/app/FAKE/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ 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 @@ -89,7 +87,6 @@ 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 @@ -137,7 +134,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 = Seq.toList hostBasedEnvArgs @ CommandlineParams.parseArgs (fakeArgs |> Seq.filter ((<>) buildScriptArg) |> Seq.filter ((<>) "details"))
let args = CommandlineParams.parseArgs (fakeArgs |> Seq.filter ((<>) buildScriptArg) |> Seq.filter ((<>) "details"))

traceStartBuild()
let printDetails = containsParam "details" cmdArgs
Expand Down
22 changes: 14 additions & 8 deletions src/app/FakeLib/TraceListener.fs
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,20 @@ type ConsoleTraceListener(importantMessagesToStdErr, colorMap) =
let writeText toStdErr color newLine text =
let curColor = Console.ForegroundColor
try
if curColor <> color then Console.ForegroundColor <- color
let printer =
match toStdErr, newLine with
| true, true -> eprintfn
| true, false -> eprintf
| false, true -> printfn
| false, false -> printf
printer "%s" text
try
if curColor <> color then Console.ForegroundColor <- color
let printer =
match toStdErr, newLine with
| true, true -> eprintfn
| true, false -> eprintf
| false, true -> printfn
| false, false -> printf
printer "%s" text
with
| :? ArgumentException when EnvironmentHelper.isMono ->
printfn "* Color output has been disabled because of a bug in GNOME Terminal."
printfn "* Hint: To workaround this bug, please set environment property TERM=xterm-256color"
reraise()
finally
if curColor <> color then Console.ForegroundColor <- curColor

Expand Down