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 and Water-Melon committed Sep 25, 2024
1 parent 5e93525 commit 1b97d40
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 1b97d40

Please sign in to comment.