From 10a1f7dab94095818f0bded1e03eb15e382661b2 Mon Sep 17 00:00:00 2001 From: keitosuwahara Date: Fri, 15 Aug 2025 23:38:40 +0900 Subject: [PATCH] Improving the robustness of prerequisite checks --- Script/run_devcontainer_claude_code.ps1 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Script/run_devcontainer_claude_code.ps1 b/Script/run_devcontainer_claude_code.ps1 index 5b99d7d..468750e 100644 --- a/Script/run_devcontainer_claude_code.ps1 +++ b/Script/run_devcontainer_claude_code.ps1 @@ -40,14 +40,18 @@ Write-Host "Using backend: $($Backend)" # --- Prerequisite Check --- Write-Host "Checking for required commands..." 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." - 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." } catch { - Write-Error "A required command is not installed or not in your PATH." - Write-Error "Please ensure '$($_.Exception.Message.Split(':')[0])' and 'devcontainer' are installed and accessible." + Write-Error "A required command is not installed or not in your PATH. $($_.Exception.Message)" + Write-Error "Please ensure both '$Backend' and 'devcontainer' are installed and accessible in your system's PATH." exit 1 }