fix: narrow REAPED_STATUSES cfg to non-Linux unix only#346
Conversation
The static is only written/read behind #[cfg(all(unix, not(target_os = "linux")))], but was declared with #[cfg(unix)], causing a dead_code warning on Linux. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR fixes a dead-code warning on Linux CI by narrowing the Confidence Score: 5/5Safe to merge — one-line cfg gate correction with no behavioral change. The change is a targeted, correct fix that aligns the declaration's cfg gate with every existing usage site. No logic is altered, and the fix resolves a real clippy -D warnings failure on Linux CI. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[SIGCHLD received] --> B{Platform?}
B -->|Linux| C["waitid(Id::All, WNOWAIT|WNOHANG|WEXITED)\nPeek at next zombie"]
B -->|non-Linux Unix| D["waitpid(None, WNOHANG)\nBlind reap — may race"]
C --> E{PID managed?}
E -->|Yes| F[Skip — leave for Tokio child.wait]
E -->|No| G["waitpid(Pid, WNOHANG)\nActually reap it"]
D --> H{PID managed?}
H -->|No| I[Reap as orphan]
H -->|Yes – race lost| J["REAPED_STATUSES.insert(pid, code)\n#[cfg(all(unix, not(target_os = 'linux')))]"]
Reviews (1): Last reviewed commit: "fix: narrow REAPED_STATUSES cfg to non-L..." | Re-trigger Greptile |
There was a problem hiding this comment.
Code Review
This pull request updates the conditional compilation for the REAPED_STATUSES static variable in src/supervisor/mod.rs. The variable is now restricted to non-Linux Unix platforms, as Linux utilizes waitid with WNOWAIT to handle process reaping without needing this map. I have no feedback to provide.
## 🤖 New release * `pitchfork-cli`: 2.5.0 -> 2.6.0 <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [2.6.0](v2.5.0...v2.6.0) - 2026-04-12 ### Added - *(proxy)* auto start when visiting the proxied URL ([#347](#347)) ### Fixed - some issues related to sudo supervisor ([#323](#323)) - *(port)* should fail when ready_port is in use ([#350](#350)) - *(deps)* update rcgen to 0.14 ([#349](#349)) - *(deps)* update reqwest to 0.13 ([#348](#348)) - detect port conflicts on loopback addresses, not just 0.0.0.0 ([#345](#345)) - narrow REAPED_STATUSES cfg to non-Linux unix only ([#346](#346)) - *(deps)* update rust crate ratatui to 0.30 ([#331](#331)) - *(deps)* update rust crate toml to v1 ([#344](#344)) - *(deps)* update rust crate strum to 0.28 ([#334](#334)) - *(deps)* update rust crate notify-debouncer-full to 0.7 ([#330](#330)) - *(deps)* update rust crate nix to 0.31 ([#329](#329)) - *(deps)* update rust crate listeners to 0.5 ([#328](#328)) - *(deps)* update rust crate sysinfo to 0.38 ([#335](#335)) - *(deps)* update rust crate cron to 0.16 ([#324](#324)) - *(deps)* update rust crate crossterm to 0.29 ([#325](#325)) ### Other - *(deps)* update rust crate rmcp to v1.4.0 ([#327](#327)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: this PR only bumps the crate version and updates release notes, with no runtime code changes. > > **Overview** > Prepares the `pitchfork-cli` **v2.6.0** release by bumping the package version from `2.5.0` to `2.6.0` in `Cargo.toml`/`Cargo.lock`. > > Updates `CHANGELOG.md` with the `2.6.0` release notes (proxy auto-start behavior, several fixes, and dependency updates). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit faea6c5. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Summary
REAPED_STATUSESwas declared with#[cfg(unix)]but only written/read behind#[cfg(all(unix, not(target_os = "linux")))]dead_codewarning that failsclippy -D warningsTest plan
cargo clippy --all-targets --all-features -- -D warningspasses on Linux without warnings🤖 Generated with Claude Code
Note
Low Risk
Low risk: this only tightens a
cfggate for a static used exclusively on non-Linux Unix, reducing Linux-onlydead_code/clippy warnings without changing runtime behavior on supported paths.Overview
Narrowed the
REAPED_STATUSESstatic’s compile-timecfgfrom#[cfg(unix)]to#[cfg(all(unix, not(target_os = "linux")))]so it is only compiled on platforms where it’s actually used.This avoids Linux
dead_codewarnings (and resultingclippy -D warningsfailures) while leaving Linux zombie-reaping behavior unchanged.Reviewed by Cursor Bugbot for commit 7d53370. Bugbot is set up for automated code reviews on this repo. Configure here.