Fix install script swallowing file-lock errors and reporting false success#15419
Fix install script swallowing file-lock errors and reporting false success#15419
Conversation
… success messages When aspire.exe was locked by another process, Move-Item in Backup-ExistingCliExecutable failed as a non-terminating error and execution continued, causing Expand-Archive to also fail silently and the success message to be displayed regardless. - Wrap Move-Item in Backup-ExistingCliExecutable with try/catch + -ErrorAction Stop in both get-aspire-cli.ps1 and get-aspire-cli-pr.ps1, throwing a clear actionable message when the backup fails - Add -ErrorAction Stop to Expand-Archive in both scripts so extraction failures are caught by the existing catch block - Add exit-code check for tar in get-aspire-cli.ps1 (pr variant already had it) Co-authored-by: radical <1472+radical@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15419Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15419" |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Improves robustness of the Aspire CLI install PowerShell scripts by converting previously non-terminating file operation failures (notably when aspire.exe is locked) into terminating errors that are properly caught and reported, preventing false “success” output.
Changes:
- Make backup/restore of existing CLI executable fail fast (
-ErrorAction Stop) and surface an actionable error when backup can’t be created. - Ensure archive extraction failures are terminating (
Expand-Archive -ErrorAction Stop) so the existingtry/catchlogic runs (including backup restore). - Add Unix
tarexit-code validation inget-aspire-cli.ps1(PR variant already had this behavior).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| eng/scripts/get-aspire-cli.ps1 | Harden backup/restore + extraction paths to avoid swallowed errors and false success; add tar exit-code check. |
| eng/scripts/get-aspire-cli-pr.ps1 | Align PR installer with the same backup/restore + extraction error handling improvements. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…stall-error-message
…install-error-message' into copilot/fix-aspire-install-error-message
|
Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🎬 CLI E2E Test Recordings — 49 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #23501668867 |
When CLI installation hits a filesystem error, especially a locked
aspire.exeon Windows, parts of the PowerShell install flow were relying on commands that emit non-terminating errors. That allowed the script to continue after a failed backup or extraction step and still print the success message.Changes
Applies to
eng/scripts/get-aspire-cli.ps1andeng/scripts/get-aspire-cli-pr.ps1.-ErrorAction Stopwhere failure should abort the operation.Backup-ExistingCliExecutableto remove stale*.old.*backups before creating a new backup, matching self-update behavior.Move-Itemintry/catchand throw a clearer, actionable error when the existing CLI cannot be moved because it is in use.Expand-Archivefailures terminating so the existing restore/error path runs instead of falling through to the success message.get-aspire-cli.ps1, check$LASTEXITCODEaftertarextraction so Unix extraction failures are surfaced correctly.tarstdout/stderr and include it in the thrown extraction error whentarexits non-zero.Result
If the installer cannot replace the existing CLI, or if extraction/rollback fails, it now fails with clear actionable errors instead of reporting a successful install.
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue:Original prompt