fix: remove extra shift in --no-telemetry flag parsing in install-azd.sh#8423
Conversation
The --no-telemetry case branch had an erroneous shift before setting the variable. Since --no-telemetry is a boolean flag (no value argument), it should not shift inside its case branch — the loop's trailing shift already advances past the flag. The extra shift caused a failure under set -e when --no-telemetry was the last argument, as shifting past an empty argument list returns non-zero. Fixes #8311 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the cli/installer/install-azd.sh argument parsing loop to fix --no-telemetry handling by removing an extra shift that could cause the script to exit under set -e when the flag is last.
Changes:
- Remove an erroneous
shiftin the--no-telemetrycase branch to avoid shifting past the end of the argv list.
- Fix no_telemetry value mismatch: init as false, check against true - Add -t short form to case pattern to match help text Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Description
The
--no-telemetrycase branch ininstall-azd.shhad an erroneousshiftbefore setting the variable. Since--no-telemetryis a boolean flag (no value argument), it should not shift inside its case branch — the loop's trailingshiftalready advances past the flag. The extra shift caused a failure underset -ewhen--no-telemetrywas the last argument (or in any position without a following argument to consume), as shifting past an empty argument list returns non-zero.Fix
Removed the extra
shiftfrom the--no-telemetrycase branch, matching the pattern used by other boolean flags (--dry-run,--skip-verify,--verbose).Verification
ERROR: Unhandled error)--no-telemetryin any argument position (--dry-run --no-telemetryand--no-telemetry --dry-run)Fixes #8311