Bug Description
When the Servy CLI executable (servy-cli.exe) is not found through any of the three discovery steps in Servy.psm1, the error message in Test-ServyCliPath can be misleading.
Steps to Reproduce
- Use the PowerShell module on a system where Servy is not installed
- Place the module in a folder that does not contain
servy-cli.exe
- Call any Servy function (e.g.
Show-ServyVersion)
Expected Behavior
The error message should clearly indicate that servy-cli.exe was not found in any of the searched locations (module folder, Program Files, system PATH).
Actual Behavior
The module initialization tries three paths in sequence:
# 1. Check local module folder
$script:ServyCliPath = Join-Path $ModuleRoot "servy-cli.exe"
# 2. Check 64-bit Program Files directory
if (-not (Test-Path $script:ServyCliPath)) {
$basePath = if ($env:ProgramW6432) { $env:ProgramW6432 } else { $env:ProgramFiles }
$script:ServyCliPath = Join-Path $basePath "Servy\servy-cli.exe"
}
# 3. Check system PATH
if (-not (Test-Path $script:ServyCliPath)) {
$pathSearch = Get-Command "servy-cli.exe" -ErrorAction SilentlyContinue
if ($pathSearch) { $script:ServyCliPath = $pathSearch.Definition }
}
Bug Description
When the Servy CLI executable (
servy-cli.exe) is not found through any of the three discovery steps inServy.psm1, the error message inTest-ServyCliPathcan be misleading.Steps to Reproduce
servy-cli.exeShow-ServyVersion)Expected Behavior
The error message should clearly indicate that
servy-cli.exewas not found in any of the searched locations (module folder, Program Files, system PATH).Actual Behavior
The module initialization tries three paths in sequence: