Commit 1c9601c
Add PowerShell version logging for activation debugging (#851)
Implementing better PowerShell version logging for activation debugging
as requested in issue #706.
The issue stems from the PR review comment
(#693 (comment))
suggesting that logging PowerShell version information would be valuable
for debugging activation failures, especially given the differences
between Windows PowerShell 5.x and PowerShell 7+.
## Changes Made:
- [x] Analyze current PowerShell activation flow in pwshStartup.ts and
pwshEnvs.ts
- [x] Examine existing logging patterns and utilities
- [x] Test current build/compile state of project
- [x] Create utility function to detect PowerShell version via
`$PSVersionTable.PSVersion.Major`
- [x] Add PowerShell version logging to relevant activation code paths
- [x] Add version logging for both conda and non-conda activation
scenarios
- [x] Ensure logging follows existing patterns (traceInfo/traceVerbose)
- [x] Test changes and verify proper logging output
- [x] Use shorter -c flag instead of -Command for PowerShell commands
## Implementation Details:
1. **Added `getPowerShellVersion()` function** - Detects PowerShell
major version using `$PSVersionTable.PSVersion.Major` command with `-c`
flag
2. **Enhanced installation logging** - Now logs PowerShell version when
shells are detected (e.g., "SHELL: pwsh is installed (version 7)")
3. **Enhanced activation script error messages** - PowerShell errors now
include version info (e.g., "Failed to activate Python environment
(PowerShell 7): error details")
## Testing:
- All existing unit tests pass (128 passing)
- Code compiles successfully with no lint errors
- Manual testing confirms PowerShell version detection works correctly
These changes provide better diagnostic information for debugging
PowerShell activation issues without affecting existing functionality.
Fixes #706.
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 Share your feedback on Copilot coding agent for the chance to win a
$200 gift card! Click
[here](https://survey3.medallia.com/?EAHeSx-AP01bZqG0Ld9QLQ) to start
the survey.
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: eleanorjboyd <[email protected]>1 parent 47206e3 commit 1c9601c
1 file changed
+29
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
61 | 82 | | |
62 | 83 | | |
63 | 84 | | |
| |||
125 | 146 | | |
126 | 147 | | |
127 | 148 | | |
128 | | - | |
| 149 | + | |
| 150 | + | |
129 | 151 | | |
130 | 152 | | |
131 | 153 | | |
| |||
220 | 242 | | |
221 | 243 | | |
222 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
223 | 251 | | |
224 | 252 | | |
225 | 253 | | |
| |||
0 commit comments