fix: handle channel send errors in watch_files.rs#157
Merged
Conversation
Replace .unwrap() on channel send with proper error handling. The send can fail if the receiver is dropped during shutdown, which is expected behavior and should not cause a panic. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a potential panic during shutdown by gracefully handling channel send errors in the file watcher callback.
Changes:
- Replaced
.unwrap()on channel send withlet _ =to ignore send errors when the receiver is dropped during shutdown
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merged
jdx
added a commit
that referenced
this pull request
Jan 19, 2026
## 🤖 New release * `pitchfork-cli`: 1.0.1 -> 1.0.2 <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [1.0.2](v1.0.1...v1.0.2) - 2026-01-19 ### Fixed - handle channel send errors in watch_files.rs ([#157](#157)) - implement clean IPC server shutdown ([#154](#154)) - replace unwraps with proper error handling in deps.rs ([#153](#153)) ### Other - *(deps)* lock file maintenance ([#158](#158)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Release**: *v1.0.2* > > - Bumps package version to `1.0.2` in `Cargo.toml`, `Cargo.lock`, `docs/cli/*`, and `pitchfork.usage.kdl` > - Updates `CHANGELOG.md` with fixes: channel send error handling, clean IPC server shutdown, and replacing `unwrap` with proper error handling > - Regenerates CLI docs (`docs/cli/commands.json`, `docs/cli/index.md`) reflecting the new version > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 459c60f. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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.
Summary
.unwrap()on channel send insrc/watch_files.rs:39withlet _ =to gracefully ignore errorsWhy this matters
Previously, if the
WatchFilesstruct was dropped while the file watcher callback was still active, thetx.send().await.unwrap()would panic. This could happen during normal shutdown sequences.Test plan
🤖 Generated with Claude Code
Note
Prevents a potential panic during shutdown by making the file watcher’s send non-fatal.
src/watch_files.rs, replacetx.send(paths).await.unwrap()withlet _ = tx.send(paths).await;inside the debouncer callback so send errors (e.g., receiver dropped) are ignoredWritten by Cursor Bugbot for commit e16c30e. This will update automatically on new commits. Configure here.