Improving the robustness of prerequisite checks

This commit is contained in:
keitosuwahara
2025-08-15 23:38:40 +09:00
parent afb0fc9156
commit 10a1f7dab9

View File

@@ -40,14 +40,18 @@ Write-Host "Using backend: $($Backend)"
# --- Prerequisite Check --- # --- Prerequisite Check ---
Write-Host "Checking for required commands..." Write-Host "Checking for required commands..."
try { try {
Get-Command $Backend -ErrorAction Stop | Out-Null if (-not (Get-Command $Backend -ErrorAction SilentlyContinue)) {
throw "Required command '$($Backend)' not found."
}
Write-Host "- $($Backend) command found." Write-Host "- $($Backend) command found."
Get-Command devcontainer -ErrorAction Stop | Out-Null if (-not (Get-Command devcontainer -ErrorAction SilentlyContinue)) {
throw "Required command 'devcontainer' not found."
}
Write-Host "- devcontainer command found." Write-Host "- devcontainer command found."
} }
catch { catch {
Write-Error "A required command is not installed or not in your PATH." Write-Error "A required command is not installed or not in your PATH. $($_.Exception.Message)"
Write-Error "Please ensure '$($_.Exception.Message.Split(':')[0])' and 'devcontainer' are installed and accessible." Write-Error "Please ensure both '$Backend' and 'devcontainer' are installed and accessible in your system's PATH."
exit 1 exit 1
} }