-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ptapply to work in PowerShell 7 #68
Conversation
Fixes gundermanc#67 Update `src/Features/Patch.Autoload.psm1` to support PowerShell 7. * Add a check to determine if running in PowerShell 7 by checking `$PSVersionTable.PSVersion.Major`. * Update the `$powershellPath` variable to use `pwsh.exe` if running in PowerShell 7, otherwise use `powershell.exe`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/gundermanc/tools/issues/67?shareId=XXXX-XXXX-XXXX-XXXX).
This was all generated by Copilot Workspaces. It hasn't been tested yet. |
This does work; however, the version checking is still broken. tools/src/Features/Patch.Autoload.psm1 Line 201 in 56037f4
This could be because ps7 uses .NET vs Framework. I couldn't get it to work, but the files still patch. I'll open a separate issue. |
Verified this change works in both Windows PowerShell and PowerShell 7 on a Windows machine. |
@@ -187,7 +187,11 @@ function CheckAssemblyVersions($source, $destination) | |||
|
|||
Write-Host " - Checking that assembly versions match..." | |||
|
|||
$powershellPath = (Join-Path $PsHome "powershell.exe") | |||
if ($PSVersionTable.PSVersion.Major -ge 6) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment as to why this is necessary, what the behavior would be without it, and what's expected?
Can you rev- the version number? |
Fixes #67
Update
src/Features/Patch.Autoload.psm1
to support PowerShell 7.$PSVersionTable.PSVersion.Major
.$powershellPath
variable to usepwsh.exe
if running in PowerShell 7, otherwise usepowershell.exe
.For more details, open the Copilot Workspace session.