microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
23.35k stars 1.45k forks source link

winget upgrade can't upgrade powershell when ran from powershell #4097

Open bandwiches opened 10 months ago

bandwiches commented 10 months ago

Brief description of your issue

You cannot upgrade powershell using winget in powershell, the installer cannot proceed since PowerShell is open.

Steps to reproduce

Expected behavior

Expected the installer to complete in some fashion, regardless if I close my powershell session.

Actual behavior

Installer fails to proceed because powershell is running. You cannot close powershell or it will exit the installer.

Environment

Windows Package Manager v1.6.3482
Windows: Windows.Desktop v10.0.19045.3930
Package: Microsoft.DesktopAppInstaller v1.21.3482.0
denelon commented 10 months ago

I don't typically run the upgrade interactively. @SteveL-MSFT any ideas on this one?

SteveL-MSFT commented 10 months ago

This is the "normal" open file handles problem on Windows. As the PowerShell binaries are running, you can't overwrite them, but if you run winget within PowerShell and close PowerShell, then of course all of it will get closed. What we need is a Windows feature to virtualize a part of the filesystem so the installer can run and when the last open process closes, Windows will "fix" the filesystem to point to the new files.

bandwiches commented 10 months ago

I don't typically run the upgrade interactively. @SteveL-MSFT any ideas on this one?

I did not catch the --disable-interactivity flag! Thanks for the heads up

mominshaikhdevs commented 8 months ago

What we need is a Windows feature to virtualize a part of the filesystem so the installer can run and when the last open process closes, Windows will "fix" the filesystem to point to the new files.

seems like /SWAPRUN (https://github.com/microsoft/WindowsAppSDK/discussions/3061#discussioncomment-4021711)