-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat(config): Allow Scoop to ignore running processes during reset/uninstall/update #4713
feat(config): Allow Scoop to ignore running processes during reset/uninstall/update #4713
Conversation
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.
Just some suggestions for improving the wording, I haven't actually tested the functionality - I'll leave that to the maintainers.
I don't like this idea, a conclusion notes after all uninstallation to remind user that some apps are still running and not uninstalled is more better, since this one will interrupt the unattended uninstalling process. Or add a new config option to let scoop force exit all running processes and uninstall/update the apps. |
I agree that this change is backward incompatible and breaks unattended process. As I mentioned in the opening, if the community would come up with a "force exit running process" option, I'm OK with that too. Maybe provide that as a @rashil2000, what do you think? |
Hmm, the config option is a much better UX. It does not break any previous user workflows, and offers customizability without needing to ask the user for a prompt each time. For implementation of the config option, you can refer to this PR - #4155 You'll also need to update the libexec/scoop-config.ps1 file, for documentation. |
OK. Just to recap the new requirements:
Is this good? EDIT: Since we are adding an option now, maybe we make the current "prompt" approach as one of the choices, so that people who don't care about unattended process but want to save progress before forceful process kill have a chance to do so? Instead of a yes/no question, we could make the prompt something like "Scoop is about to stop all running processes of $app_name. Save progress and press any key to continue..." Basically a three-choice option: "stop_running_process" -> either "no" (the default), "silent" or "prompt". |
Updated the PR. Moved the handling logic to core.ps1 for reuse between all the 3 use cases. If this function is better placed in a different file, please advise. |
Do you think Scoop should stop the process if enabled? It will most likely fail (and print a wall of errors) - unless they are stopped in the proper order and with the proper flags (like The config option should be boolean - false (by default) to retain current behaviour, and true to just print the warning and proceed with uninstaller script. |
For the code, put the function under |
According to the PowerShell doc, without I tried several apps locally, and I don't get any problem. If you have see errors with this impl, could you provide the repro steps?
To clarify, I think we are discussing about two use cases:
For 2, I completely agree we should leave to the uninstaller script.
Done. |
I've encountered problems outside of Scoop, where a generic Stop-Process isn't enough.
That's preferable, to be honest. Scoop is a pretty non-invasive manager, and doing something outside of its scope will deviate from that. As I said, if any apps need special-casing, manifest authors will include a Stop-Process in their uninstaller scripts, and I think that's sufficient. |
Understood. I'll remove the |
Manual test steps I did:
===== Is there any test file need update? |
Looks great. I'll do a proper review later today. Hmm, I don't think there are tests for this. @niheaven can you confirm? |
Vague idea: instead of a config option, how about we detect the presence of |
Nope, this process related to specific app installation/update cannot be tested. Just run BTW, you should check config before running the new function to avoid |
IMO, the pro of the current impl is that it's explicit. User has to express the consent to make it work. What if some user super concern of losing unsaved file in their text editor? They will not have a choice. If we rely on uninstaller entirely, at least we should update the wiki here so that future authors are aware of the implication.
Sorry, can you explain? I understand I can hoist the |
Aha sorry, I misunderstood the logic of the function 🤣 Please ignore it. |
Hmm, yeah makes sense. Let's leave it as it is. |
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.
We should call it ignore_running_processes
to be more clear.
Please add an entry in the changelog |
Call the function |
Oh, you mean I should make the function "ignore_running_process", not "handle_running_processes"? What about the config? Any suggestion? Or you can change the PR yourself, feel free to just modify it. BTW, the current Sorry for misunderstanding. |
This should be |
It should be
Okay, I'll change it a little, feel free to reverse my commit if it got something wrong |
@CrendKing Done. @rashil2000 Moved. |
@CrendKing If this is fine, I'll merge it. |
Of course. Go ahead. Thank you guys! |
Thanks for the contribution @CrendKing! |
It's been fixed in #4731, you could try it 🤣 |
That's exactly what I'm looking for. Sorry didn't notice that commit. Thank you! |
…install/update (ScoopInstaller#4713) Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com>
Description
When any process of an application is still running, currently during uninstallation (
uninstall
orupdate
), it unconditionally prints error message "Application is still running. Close all instances and try again" and exits. While this approach minimizes risk of data loss, manifest author has no control over the procedure.Some apps consist of constantly running services and drivers, which has no GUI. In such case, user may have no idea how to "close all instances", and get stuck. Manifest author might be able to
Stop-Service
or call certain external command to stop those processes, but the current logic prevents this.One simple way to fix this is adding a prompt during uninstallation, as this PR demonstrates. If Scoop detects process running, it calls
Read-Host
to ask user permission to proceed the "uninstaller" script, assuming which will take care of the process termination. In case user answers "N", there will be no change.Currently there is no flag to guard this change, so all users will be immediately affected by this change. I have no previous experience on how Scoop usually handle these kind of changes. We could create a new property in manifest structure to activate this.
Furthermore, if this is approved, we could even always attempt to call
Stop-Process -Name $bin
after prompt, where "$bin" is the string provided in the manifest's "bin" property, if exist. This way we could streamline the app update even more.Motivation and Context
Closes #4710
How Has This Been Tested?
scoop uninstall <app_name>
.4.1. Press any key other than "y" results in the "Application is still running. Close all instances and try again" message.
4.2. Press "y", the uninstallation continues.
Stop-Process -Name <app_name>
, app is closed and unininstalled successfully.5.1. If not, uninstallation fails with error "Couldn't remove <app_dir>; it may be in use."
Checklist: