Keep Scoop package listings working when scoop commands fail - #5321
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors Scoop process handling to prevent output-pipe deadlocks and improve timeout resilience.
Changes:
- Centralizes concurrent stdout/stderr draining in
ScoopProcess. - Adds safer listing and index-refresh timeout handling.
- Adds Windows tests for stderr pipe flooding.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
ScoopProcessTests.cs |
Tests process output under heavy stderr. |
TestProcessTaskLogger.cs |
Adds a process logger test fake. |
PackageManager.cs |
Adds tracked timeouts and safe index refresh. |
Scoop.cs |
Uses centralized process handling. |
ScoopSourceHelper.cs |
Refactors source-list output reading. |
ScoopProcess.cs |
Implements concurrent stream draining. |
ScoopPkgDetailsHelper.cs |
Reads stderr concurrently with manifest output. |
Suppressed comments (2)
src/UniGetUI.PackageEngine.Managers.Scoop/Scoop.cs:472
- The
scoop listprocess is still missing from the timeout tracker. This path runs both for installed-package listings and inside update listings, so a hung process survives the 60-second timeout and the automatic retry may attach to or leave behind the same blocked task. Register it before callingReadLines.
return ParseInstalledPackages(ScoopProcess.ReadLines(p, logger));
src/UniGetUI.PackageEngine.Managers.Scoop/Scoop.cs:503
- A failed
scoop updatenormally reports failure through a nonzero exit code, butReadToEndonly records that code in the task logger and returns normally. ConsequentlyRefreshPackageIndexesSafelynever enters its warning path for ordinary command failures and treats the refresh as successful. Convert the nonzero result into an exception here so the new safe wrapper can report it and continue listing.
ScoopProcess.ReadToEnd(p, logger);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
src/UniGetUI.PackageEngine.Managers.Scoop/Scoop.cs:567
- When this timeout fires, the code still assigns any partial stdout drained after
Killtoversion; theUnknownfallback only runs when that output is empty. Sincescoop --versioncan emit output before hanging, the manager may be loaded with a partial/multiline value despite the warning promising an unknown version. Track the timeout and discard stdout for the version value while still draining it.
if (!process.WaitForExit(VersionProbeTimeout))
{
Logger.Warn(
$"\"scoop --version\" did not finish after {VersionProbeTimeout / 1000} seconds, "
+ "it will be killed and Scoop will be loaded with an unknown version"
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": "34e57cb0-a0ac-11f1-8ed0-5c10713c445a",
"headSha": "aad9ed6256fff163bc7a700a2d07021a8ea88057",
"reviewer": "copilot-pull-request-reviewer[bot]"
}Upstream-Commit: 4108308 Upstream-PR: Devolutions#5321
Upstream-Commit: 4108308 Upstream-PR: Devolutions#5321
This pull request refactors how process output is read and logged in the Scoop package manager integration, improving reliability when dealing with processes that produce large amounts of output, especially on standard error. It introduces a new
ScoopProcesshelper class to centralize and streamline process output handling, replaces duplicated code with calls to this helper, and adds robust timeout and error handling. Comprehensive tests are also added to ensure the new logic handles edge cases like pipe buffer overflows.Process Output Handling Improvements
ScoopProcesshelper class to encapsulate logic for reading process standard output and error streams, supporting both line-by-line and full-output reads, and ensuring proper logging and process cleanup. This prevents deadlocks and handles large error outputs robustly.Scoop.cs,ScoopPkgDetailsHelper.cs, andScoopSourceHelper.csto useScoopProcess.ReadLinesandScoopProcess.ReadToEndinstead of duplicating output reading and logging logic, simplifying these methods and improving reliability.Timeouts and Error Handling
_loadManagerVersion, preventing hangs and reporting issues if the process does not respond in time.RunListingTaskWithTimeoutlogic inPackageManager.csto allow disabling timeouts only when appropriate, and added aRefreshPackageIndexesSafelymethod to handle exceptions gracefully and warn the user if index refresh fails.Testing Enhancements
TestProcessTaskLoggerfake for unit testing process output logging.ScoopProcessTeststo verify that reading process output works even when the standard error stream is flooded, ensuring the new logic is robust against pipe buffer limitations.