winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

Always install a Powershell upgrade as last

Open j-dc opened this issue 2 years ago • 1 comments

Description of the new feature / enhancement

When winget upgrade --all is executed, the process can be terminated halfway if the package Microsoft.Powershell (or its equals) is updated.

It would be a nice feature to always execute this upgrade as last. This way, the upgrade process isn't terminated halfway.

Proposed technical implementation details

Add a custom sort.

j-dc avatar Jan 02 '23 12:01 j-dc

The issue gets worse because Microsoft Terminal is the new default, thankfully, but it also opens PowerShell 7.x so most of the time PS 7 cannot be upgraded via WinGet as it is a running instance. Maybe we need a new PR for this, haven't checked if one exists.

In most cases the msi installer will fail.

Sometimes even pretend to upgrade the package but effectively doesn't.

Winget might need to check if the PowerShell session is a seperate one (based on tasks) or from Terminal and quit the Windows Terminal or invoke a new session based on PS 5.1 to upgrade PowerShell 7.x and terminate the Microsoft Terminal before doing so, then restarting it.

I can imagine the pain as we this has several Implications

  • User need to consent the termination of Microsoft Terminal
  • not sure if winget could even jump from one Session to another and return into a newly created instance. Sounds wild, without loosing the data from running winget process.

Karl-WE avatar Jan 07 '23 01:01 Karl-WE