diff --git a/install-codex-cli.ps1 b/install-codex-cli.ps1 index 9645ddc..92fe46c 100644 --- a/install-codex-cli.ps1 +++ b/install-codex-cli.ps1 @@ -48,24 +48,33 @@ function Main { Write-Info "===== Codex CLI install script (Windows PowerShell) =====" Write-Info "Installing OpenAI Codex CLI natively..." + $tmpDir = Join-Path $env:TEMP "codex_install_$(Get-Random)" + New-Item -ItemType Directory -Path $tmpDir -Force | Out-Null + $scriptPath = Join-Path $tmpDir "install.ps1" + try { - Write-Info "Fetching and executing official installer from: https://chatgpt.com/codex/install.ps1" - - # 공식 설치 ps1 스크립트를 다운로드 및 메모리 상에서 직접 호출 가동 - $installerScript = Invoke-RestMethod -Uri "https://chatgpt.com/codex/install.ps1" -UseBasicParsing - Invoke-Expression $installerScript + Write-Info "Downloading official installer from: https://releases.openai.com/codex/install.ps1" + $ProgressPreference = 'SilentlyContinue' + Invoke-WebRequest -Uri "https://releases.openai.com/codex/install.ps1" -OutFile $scriptPath -UseBasicParsing + $ProgressPreference = 'Continue' + + if (-not (Test-Path $scriptPath)) { + Write-Err "Failed to download official Codex CLI installer." + } + + Write-Info "Executing official Codex CLI installer..." + & $scriptPath Write-Success "Codex CLI has been successfully installed!" Write-Info "Please restart your terminal window or refresh your PATH environment variable." Write-Info "Run command: codex auth (to log in) and then 'codex' to start." } catch { Write-Err "Failed to install Codex CLI: $_" + } finally { + if (Test-Path $tmpDir) { + Remove-Item -Path $tmpDir -Recurse -Force -ErrorAction SilentlyContinue + } } } -# 예기치 못한 전체 프로세스 에러 감지를 위한 Trap 설정 -trap { - Write-Err "An unexpected error occurred during installation: $_" -} - Main