Replace direct equality checks with errors.Is for context.Canceled#10
Merged
Replace direct equality checks with errors.Is for context.Canceled#10
Conversation
Copilot
AI
changed the title
[WIP] WIP address feedback on child process implementation
Replace direct equality checks with errors.Is for context.Canceled
Dec 9, 2025
… freecarnival is killed
Co-authored-by: Gustash <8539174+Gustash@users.noreply.github.com>
2e89bdb to
621e76d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves error handling for context cancellation across multiple operations by replacing direct equality checks with errors.Is(). This ensures proper detection of context cancellation even when errors are wrapped by intermediate layers.
Key changes:
- Updated cancellation checks in command handlers (launch, install, update)
- Fixed download worker and progress cancellation detection
- Added
errorspackage imports where needed
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| download/downloader.go | Updated two context cancellation checks in download progress handling and worker routine to use errors.Is() |
| cmd_update.go | Updated update cancellation check to use errors.Is() for proper wrapped error detection |
| cmd_install.go | Updated install cancellation check to use errors.Is() for proper wrapped error detection |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Direct equality comparison with
context.Canceledfails when errors are wrapped. This affects cancellation handling across install, update, launch, and download operations.Changes
err == context.Canceledwitherrors.Is(err, context.Canceled)in:cmd_launch.go- game launch cancellationcmd_install.go- install cancellationcmd_update.go- update cancellationdownload/downloader.go- download progress and worker cancellation (2 locations)Example
This ensures proper detection of context cancellation even when errors are wrapped by intermediate layers.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.