Skip to content

Commit e56e9e6

Browse files
Improve version extraction in Update-AITool
Refines the process of retrieving the current tool version by selecting only the first line of output and trimming whitespace. This ensures more accurate version parsing from command output.
1 parent 95b729f commit e56e9e6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

public/Update-AITool.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ function Update-AITool {
8888
$tool = $script:ToolDefinitions[$toolName]
8989
$oldVersion = $null
9090
if (Test-Command -Command $tool.Command) {
91-
$oldVersion = & $tool.Command --version 2>&1 | Out-String
92-
$oldVersion = $oldVersion -replace '^.*?(\d+\.\d+\.\d+).*$', '$1'
91+
$oldVersion = & $tool.Command --version 2>&1 | Select-Object -First 1
92+
$oldVersion = ($oldVersion -replace '^.*?(\d+\.\d+\.\d+).*$', '$1').Trim()
9393
Write-PSFMessage -Level Verbose -Message "Current version: $oldVersion"
9494
}
9595

0 commit comments

Comments
 (0)