Skip to content

fix: handle channel send errors in watch_files.rs#157

Merged
jdx merged 1 commit into
mainfrom
fix/watch-files-send-error-handling
Jan 19, 2026
Merged

fix: handle channel send errors in watch_files.rs#157
jdx merged 1 commit into
mainfrom
fix/watch-files-send-error-handling

Conversation

@jdx

@jdx jdx commented Jan 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace .unwrap() on channel send in src/watch_files.rs:39 with let _ = to gracefully ignore errors
  • The send can fail if the receiver is dropped during shutdown, which is expected behavior

Why this matters

Previously, if the WatchFiles struct was dropped while the file watcher callback was still active, the tx.send().await.unwrap() would panic. This could happen during normal shutdown sequences.

Test plan

  • All 76 tests pass
  • Clippy passes with no warnings

🤖 Generated with Claude Code


Note

Prevents a potential panic during shutdown by making the file watcher’s send non-fatal.

  • In src/watch_files.rs, replace tx.send(paths).await.unwrap() with let _ = tx.send(paths).await; inside the debouncer callback so send errors (e.g., receiver dropped) are ignored

Written by Cursor Bugbot for commit e16c30e. This will update automatically on new commits. Configure here.

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>
Copilot AI review requested due to automatic review settings January 19, 2026 05:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 with let _ = 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.

@jdx jdx merged commit 4e3dff7 into main Jan 19, 2026
4 checks passed
@jdx jdx deleted the fix/watch-files-send-error-handling branch January 19, 2026 05:25
@jdx jdx mentioned this pull request Jan 19, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants