Skip to content

Commit

Permalink
[Ubuntu] Make brew version check consistent (actions#10369)
Browse files Browse the repository at this point in the history
`Tools.Tests.ps1` checks the version of `brew` with `--version` argument.

```powershell
    Describe "Homebrew" {
    It "homebrew" {
        "/home/linuxbrew/.linuxbrew/bin/brew --version" | Should -ReturnZeroExitCode
    }
}
```

`SoftwareReport.Common.psm1` checks it with `-v` argument.

```powershell
    function Get-HomebrewVersion {
        $result = Get-CommandResult "/home/linuxbrew/.linuxbrew/bin/brew -v"
        $result.Output -match "Homebrew (?<version>\d+\.\d+\.\d+)" | Out-Null
        return $Matches.version
    }
```

Generally, `--version` and `-v` are equivalent. But a recent bug in `brew` makes `-v` returns the output of `brew help`.

Homebrew/brew#17903

It's best to maintain consistency in version checks and explicitly use `--version` in both places.
  • Loading branch information
enescakir authored Jul 30, 2024
1 parent 582bbb9 commit da684ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion images/ubuntu/scripts/docs-gen/SoftwareReport.Common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function Get-LernaVersion {
}

function Get-HomebrewVersion {
$result = Get-CommandResult "/home/linuxbrew/.linuxbrew/bin/brew -v"
$result = Get-CommandResult "/home/linuxbrew/.linuxbrew/bin/brew --version"
$result.Output -match "Homebrew (?<version>\d+\.\d+\.\d+)" | Out-Null
return $Matches.version
}
Expand Down

0 comments on commit da684ca

Please sign in to comment.