Open soredake opened 3 months ago
When you are cleaning old versions that are still running, you will receive "Remove-Item : Cannot remove item" error.
To reproduce this: 1) Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser 2) Invoke-RestMethod -Uri https://get.scoop.sh/ | Invoke-Expression 3) scoop install git 4) scoop bucket add extras 5) scoop install syncthingtray@1.4.13 6) run syncthing tray 7) scoop install syncthingtray@1.5.0 8) scoop cleanup -a -k 9) error:
Remove-Item : Cannot remove item C:\Users\ruruo\scoop\apps\syncthingtray\1.4.13\syncthingtray.exe: Access to the path 'syncthingtray.exe' is denied. At C:\Users\ruruo\scoop\apps\scoop\current\libexec\scoop-cleanup.ps1:50 char:9 + Remove-Item $dir -ErrorAction Stop -Recurse -Force + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : PermissionDenied: (syncthingtray.exe:FileInfo) [Remove-Item], UnauthorizedAccessExceptio n + FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand
Related: https://github.com/ScoopInstaller/Scoop/issues/2035
Add option to scoop cleanup for closing running apps to avoid "PermissionDenied" when apps are still running.
scoop cleanup
Not having such option.
Would be nice if this code can be adapted for cleanup command https://github.com/ScoopInstaller/Scoop/blob/d337bb1fa69a56637101254a1ac9e0ad13a12647/lib/install.ps1#L1147-L1165
cleanup
Feature Request
Is your feature request related to a problem? Please describe.
When you are cleaning old versions that are still running, you will receive "Remove-Item : Cannot remove item" error.
To reproduce this: 1) Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser 2) Invoke-RestMethod -Uri https://get.scoop.sh/ | Invoke-Expression 3) scoop install git 4) scoop bucket add extras 5) scoop install syncthingtray@1.4.13 6) run syncthing tray 7) scoop install syncthingtray@1.5.0 8) scoop cleanup -a -k 9) error:
Related: https://github.com/ScoopInstaller/Scoop/issues/2035
Describe the solution you'd like
Add option to
scoop cleanup
for closing running apps to avoid "PermissionDenied" when apps are still running.Describe alternatives you've considered
Not having such option.