Repository navigation
Stop the update when a "close apps" process cannot be closed - #5624
Merged
Gabriel Dufresne (GabrielDuf) merged 1 commit intoOct 28, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the changes requiring configured app-closing steps to succeed before package operations continue.
No open issues 🎉
What changed in this PR
This PR prevents package operations from continuing when a user-configured “Close apps before installing” step fails, addressing the still-running-app scenario behind #5076.
Changes:
- Return failure when a process survives the close request and force-kill is disabled.
- Require user-configured close steps to succeed, while leaving automatic close-and-retry and brokered behavior unchanged.
- Add tests for refused closure, successful force-kill, and absent processes, and update prerequisite assertions.
| File | Description |
|---|---|
src/UniGetUI.PackageEngine.Tests/PackageOperationsTests.cs |
Assert that configured close steps must succeed. |
src/UniGetUI.PackageEngine.Tests/KillProcessOperationTests.cs |
Add isolated process tests for close-step outcomes. |
src/UniGetUI.PackageEngine.Operations/PackageOperations.cs |
Make configured close steps required prerequisites. |
src/UniGetUI.PackageEngine.Operations/KillProcessOperation.cs |
Report failure when a process remains running without force-kill. |
Review effort: Balanced
There was a problem hiding this comment.
🤖 Pull request was approved automatically: the AI review is complete and all its review threads are resolved. 🎉
Integration Details
{
"deliveryId": "c3c25570-d30b-11f1-92d8-4955efde8513",
"headSha": "a9864fc2c8476cd00ac49bab84bb052deac9c627",
"reviewer": "copilot-pull-request-reviewer[bot]"
}
Gabriel Dufresne (GabrielDuf)
deleted the
fix/close-apps-fail-update-5076
branch
October 28, 2026 20:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a process listed under Close apps before installing ignored the close request and "kill processes that refuse to close" was off,
KillProcessOperationlogged that the process would not be killed but still returnedSuccess. The step was also queued withmustSucceed: false, so even a failure could not stop the update. The update then ran against the still-running app.In #5076 this produced a phantom qBittorrent update. winget runs qBittorrent's NSIS installer silently. Its running-instance check is a wizard-page LEAVE callback, so it never runs under
/S. NSIS then skips the lockedqbittorrent.exe, becauseAllowSkipFilesmakes the silent answerIDIGNORE. It still writesDisplayVersion5.2.3 and exits 0. After that, neither winget nor UniGetUI can tell that the update didn't take. The installer behaviour is upstream. The only point where UniGetUI knows something is wrong is when a process it was asked to close is still running, and until now it carried on anyway.Change
KillProcessOperationreturnsFailurewhen a process survives the close step and force-kill is off.mustSucceed: true), so its failure stops the operation. The operation fails with the existing "PreOperation … failed, and was tagged as necessary" line and offers the usual retry.Deliberately unchanged:
Behaviour change: if a user lists an app but leaves force-kill off, and the app ignores the close request (for example a tray app with no main window), the update now fails until they close the app. Before, it went ahead and could leave a half-updated install. An error raised while closing, such as access denied, now also stops the update.
Tests
KillProcessOperationTestsstart a windowless copy ofcmd/sleepunder a random name, so they can never touch a real app. They cover: a process that refuses to close fails the step, the same process with force-kill succeeds, and a name with no running process succeeds. The first test fails without the fix.PackageOperationsTestscheck on the kill step now expectsMustSucceedto be true.UniGetUI.PackageEngine.Testspasses on net10.0-windows (2863) and net10.0 (1968). Bothdotnet formatgates exit 0.Closes #5076