Skip to content

Fake writes its version string to stderr when -v is given #2066

@tebeco

Description

@tebeco

Description

It feels like the ouput of Fake build (probably the line with the version) is detected as a Build error
At the very begining of the the build (even before the restore step) the build goes from Green to red

Expected behavior

The build should not detect "Some" lines as error when it feels like it is just "Verbosity"

Actual behavior

As it is delicate for me to output code from the company here is what the build log looks like

image

Known workarounds

Manually open the log for each TeamCity build ...

Related information

  • Operating system - Win2016
  • The code targets, for the CLI, that's a good question, i use fake-cli as a dotnet-tool
  • Severity : Critical (cannot dissociate Success or failure)
  • Version of FAKE 5.4.x

the script is ran using a Powershell PS1 :

function Invoke-FakeBuild([string]$TargetName) {
    $fakeBuildArgs = "./$($fakeCli) -v run $($BuildScript) --no-cache --parallel 8 --target $($TargetName)"

    if ($SkipUnitTests -or $SkipIntegrationTests) {
        $fakeBuildArgs += " --"

        # Only set switch this for testing Pack/Push for the Fake script
        if ($SkipUnitTests) {
            $fakeBuildArgs += " --skip-unit-tests"
        }

        # Only set switch this for testing Pack/Push for the Fake script
        if ($SkipIntegrationTests) {
            $fakeBuildArgs += " --skip-integration-tests"
        }
    }

    Write-Host "Execution expression : '$($fakeBuildArgs)'"
    Invoke-Expression $fakeBuildArgs
}

Invoke-FakeBuild -TargetName $TargetName

As you can see i do not read the exit code of the Fake Build in order to let the powershell return the good exit good.

So far it ALWAYS return 0 (so in this scenario it should not affect the build result)

Finding the cullprit

Redirect StdErr to another stream :

Invoke-Expression "$($fakeBuildArgs) 2>error.log"

> cat .\error.log
FAKE 5 - F# Make (5.4.0)

not sure this is this line, because i still don't find where it is being printed out
https://github.com/fsharp/FAKE/blob/staging_5_4/src/app/Fake.Runtime/Environment.fs#L12

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions