Skip to content
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

scoop uninstall blocked when app is running #488

Open
deevus opened this issue Sep 5, 2015 · 5 comments
Open

scoop uninstall blocked when app is running #488

deevus opened this issue Sep 5, 2015 · 5 comments
Labels
bug

Comments

@deevus
Copy link
Collaborator

@deevus deevus commented Sep 5, 2015

Example:

$ scoop uninstall openssh
uninstalling openssh (5.4p1-1)
removing shim for scp
removing shim for sftp
removing shim for slogin
removing shim for ssh-add
removing shim for ssh-agent
removing shim for ssh-keygen
removing shim for ssh-keyscan
removing shim for ssh
couldn't remove ~/appdata/local/scoop\apps\openssh\5.4p1-1: it may be in use

I'm thinking that users should be able to uninstall apps regardless of whether it is running or not - which means that we need some way of stopping services before uninstalling, so that the user doesn't need to figure it out themselves.

@jonasgeiregat

This comment has been minimized.

Copy link

@jonasgeiregat jonasgeiregat commented Sep 30, 2015

Agreed! But then there should be a way to add services in the first place not ?

@deevus deevus added the bug label Jan 8, 2016
@Ash258

This comment has been minimized.

Copy link
Contributor

@Ash258 Ash258 commented Jan 5, 2019

First thing to do when uninstalling should be check for directory is in use. With information about folder is in use and two options: (it would require --force parameter for uninstallation)

  1. Some aggresive uninstallation with process killing
  2. just exit and let user manage of killing.

I could think only using Get-Process. Something like:

$procs = Get-Process -FileVersionInfo -ErrorAction SilentlyContinue | ? { $_.FileName -like '$dir`*'}
# or
# Create some hashtable from Get-Process with ID as key and Path as Value Get-Process | Select-Object Path, ID
if ($procs.Count -gt 0 -and !$forceParam) {
     abort 'Folder is in use. if you want to let scoop kill all process use unisntall -f'
} else {
    #Kill all process, which are running and continue uninstallation
    $procs | ForEach-Object { Stop-Process $_ }
}

$version = current_version $app $global
write-host "Uninstalling '$app' ($version)."
$dir = versiondir $app $version $global
$persist_dir = persistdir $app $global

@r15ch13 Do you have better solution?

@Ash258

This comment has been minimized.

Copy link
Contributor

@Ash258 Ash258 commented Jan 5, 2019

Result of get-process for running Steam

Steam

PS C:\Windows\system32> (Get-Process -FileVersionInfo -ErrorAction SilentlyContinue | ? { $_.FileName -like 'D:\scoop\ap
ps\Steam*'})

ProductVersion   FileVersion      FileName
--------------   -----------      --------
2018.2.13.864... 2018.2.13.864... D:\SCOOP\apps\Steam\current\steamapps\common\God Awe-full Clicker\GAC.exe
03.00.00.01      04.83.53.91      D:\SCOOP\apps\Steam\current\GameOverlayUI.exe
01.00.00.01      04.83.53.91      D:\SCOOP\apps\Steam\current\Steam.exe
01.00.00.01      04.83.53.91      D:\SCOOP\apps\Steam\nightly-20181111\bin\cef\cef.win7\steamwebhelper.exe
01.00.00.01      04.83.53.91      D:\SCOOP\apps\Steam\nightly-20181111\bin\cef\cef.win7\steamwebhelper.exe
01.00.00.01      04.83.53.91      D:\SCOOP\apps\Steam\nightly-20181111\bin\cef\cef.win7\steamwebhelper.exe
01.00.00.01      04.83.53.91      D:\SCOOP\apps\Steam\nightly-20181111\bin\cef\cef.win7\steamwebhelper.exe
01.00.00.01      04.83.53.91      D:\SCOOP\apps\Steam\nightly-20181111\bin\cef\cef.win7\steamwebhelper.exe
01.00.00.01      04.83.53.91      D:\SCOOP\apps\Steam\nightly-20181111\bin\cef\cef.win7\steamwebhelper.exe
                                  D:\SCOOP\apps\Steam\current\steamapps\common\God Awe-full Clicker\UnityCrashHandle...


PS C:\Windows\system32> (Get-Process -FileVersionInfo -ErrorAction SilentlyContinue | ? { $_.FileName -like 'D:\scoop\ap
ps\Steam*'}).Count
10
@r15ch13

This comment has been minimized.

Copy link
Collaborator

@r15ch13 r15ch13 commented Jan 5, 2019

Good idea 👍

It's a bit faster when the -FileVersionInfo isn't used. We don't need the file version for this. The Path property is enough.
Warning the user and do nothing would be the best way. This should also be implemented in the update process to skip running programs.

(Get-Process | ? { $_.Path -like 'D:\scoop\apps\*'} )
(Get-Process | ? { $_.Path -like 'D:\scoop\apps\<app>\*'} )
λ (Get-Process | ? { $_.Path -like 'D:\scoop\apps\*'} )

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
   2238     176   322672     451496     746,63   3832   8 firefox
   1654     198   868320     820768     701,23  17776   8 firefox
   1506     150   454816     436532     107,84  19904   8 firefox
    823      33   153628     170696     387,61  20420   8 firefox
    809     138   390228     475888      79,34  27380   8 firefox
   1524     166   481256     425892     300,42  30668   8 firefox
   1544     165   553188     494080     229,72  30920   8 firefox
    216      15     4828      83404       0,16  32460   8 firefox
    448      25    53392      58904       1,31  34272   8 QuickLook
    126       9     1320       6180       0,03  18816   8 QuickLook.WoW64HookHelper
    355      29    44316      68388       0,92   7316   8 Wavebox
    328      32    56140      82212      28,56  13692   8 Wavebox
    551      49    87400     117192       2,64  17148   8 Wavebox
    361      53   154552     172872      28,86  20368   8 Wavebox
   1646      83   128120     166200      74,45  20576   8 Wavebox
    738      43   369040     146876      21,42  20764   8 Wavebox
    305      24    26568      35984       0,11  22416   8 Wavebox
    370      75   252996     286688      52,16  24092   8 Wavebox
    357      43    88072     117712      32,67  34092   8 Wavebox
    211      14     6776      12616       0,03  34792   8 Wavebox


λ (Get-Process | ? { $_.Path -like 'D:\scoop\apps\wavebox\*'} )

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
    355      29    44316      68400       0,92   7316   8 Wavebox
    325      32    56116      82576      28,70  13692   8 Wavebox
    551      49    87400     117428       2,64  17148   8 Wavebox
    361      53   154552     172944      28,86  20368   8 Wavebox
   1661      85   128088     165180      74,70  20576   8 Wavebox
    738      43   369040     146876      21,42  20764   8 Wavebox
    302      24    26144      36320       0,11  22416   8 Wavebox
    379      76   246384     281988      52,16  24092   8 Wavebox
    359      43    87176     117444      32,81  34092   8 Wavebox
    211      14     6776      12616       0,03  34792   8 Wavebox
@Ash258 Ash258 mentioned this issue Jan 5, 2019
0 of 3 tasks complete
@Ash258

This comment has been minimized.

Copy link
Contributor

@Ash258 Ash258 commented Oct 17, 2019

Fixed as soon as #3608 arrive in master

Proper implementation will follow in #2952

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.