Add fallback to PowerShell 5 when PowerShell 7 is unavailable - #5565
Add fallback to PowerShell 5 when PowerShell 7 is unavailable#5565spboyer wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements a PowerShell 5 fallback feature that allows the script runner to gracefully fall back to PowerShell 5 when PowerShell 7 is unavailable. The feature is controlled by an alpha flag and provides enhanced compatibility for environments where PowerShell 7 is not installed.
Key changes:
- Added alpha feature flag
powershell.fallback5to enable/disable the fallback behavior - Modified PowerShell script execution logic to attempt PowerShell 5 when PowerShell 7 fails
- Enhanced error messaging to provide appropriate guidance based on fallback availability
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cli/azd/resources/alpha_features.yaml | Added new alpha feature flag powershell.fallback5 |
| cli/azd/pkg/tools/powershell/powershell.go | Implemented fallback logic and updated constructor to accept alpha features manager |
| cli/azd/pkg/tools/powershell/powershell_test.go | Added comprehensive tests for fallback behavior and alpha feature detection |
| cli/azd/pkg/ext/hooks_runner.go | Updated PowerShell script creation to pass alpha features manager |
- Enhanced checkPath function to return descriptive error messages when both PowerShell 7 and PowerShell 5 fail - Added comprehensive test suite covering alpha feature detection, fallback scenarios, and error handling - Improved user experience with clear error messaging when fallback is enabled but both PowerShell versions are unavailable
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
|
@spboyer , I am closing this in favor of #5570 The strategy is similar but a little bit more general, thinking that other shells might use the idea of And I didn't want to use an alpha feature a switch. Instead, this is becomes opt-out as part of the hook settings defintion. |
Implement a feature that allows the script runner to fall back to PowerShell 5 if PowerShell 7 is not available, enhancing compatibility and user experience. Include configuration options to enable or disable this feature.