fix: replace panics with proper error handling#90
Merged
Conversation
Replace `unwrap()`, `panic!()`, and `unreachable!()` calls with proper error handling to prevent crashes in production. Changes: - IPC client/server: Replace panic!/unreachable! with bail! - Signal handlers: Use match instead of unwrap, log warnings on failure - Environment init: Add fallbacks for current_exe, current_dir, home_dir - Supervisor: Fix child.id(), stdout/stderr capture, file opens, async writes, upsert_daemon calls, and PID parsing in spawned tasks - State file: Recover gracefully from read errors - Mutex handling: Add recovery from poisoned mutexes in procs/logger - CLI helpers: Fix regex captures, HashMap lookups, path handling Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Merged
jdx
pushed a commit
that referenced
this pull request
Jan 18, 2026
## 🤖 New release * `pitchfork-cli`: 0.2.1 -> 0.3.0 <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [0.3.0](v0.2.1...v0.3.0) - 2026-01-18 ### Added - *(web)* add devilish pitchfork theming to web UI ([#115](#115)) - *(web)* add web UI for daemon management ([#112](#112)) - show startup logs on successful daemon start ([#111](#111)) - add HTTP ready check for daemon startup ([#110](#110)) - delay autostopping daemons when leaving directory ([#108](#108)) - *(logs)* clear all logs when no daemon specified ([#109](#109)) - *(list)* show error messages in daemon list output ([#107](#107)) - refactor the code structure of `start` and `run`, allowing for parallel starting daemons ([#56](#56)) - [**breaking**] support auto start on boot ([#53](#53)) - print logs when failed on `pf start|run` ([#52](#52)) - [**breaking**] support global system/user config ([#46](#46)) - *(test)* refactor tests and add tests for `interval_watch` and `cron_watch` ([#45](#45)) ### Fixed - add timeouts to IPC operations to prevent shell hook hangs ([#106](#106)) - *(deps)* update rust crate toml to 0.9 ([#50](#50)) - replace panics with proper error handling ([#90](#90)) - *(deps)* update rust crate notify to v8 ([#78](#78)) - *(deps)* update rust crate duct to v1 ([#72](#72)) - *(deps)* update rust crate dirs to v6 ([#64](#64)) - *(deps)* update rust crate cron to 0.15 ([#48](#48)) - *(deps)* update rust crate sysinfo to 0.37 ([#49](#49)) - *(deps)* update rust crate itertools to 0.14 ([#33](#33)) - *(deps)* update rust crate strum to 0.27 ([#35](#35)) - *(deps)* update rust crate console to 0.16 ([#32](#32)) - give a user-friendly error when the work fails ([#44](#44)) ### Other - *(cli)* add long_about with examples to CLI commands ([#91](#91)) - fix documentation issues and inconsistencies ([#89](#89)) - *(deps)* lock file maintenance ([#88](#88)) - *(deps)* update rust crate serde_json to v1.0.149 ([#87](#87)) - *(deps)* lock file maintenance ([#85](#85)) - *(deps)* update rust crate serde_json to v1.0.148 ([#84](#84)) - *(deps)* update rust crate tempfile to v3.24.0 ([#82](#82)) - *(deps)* update rust crate rmp-serde to v1.3.1 ([#80](#80)) - *(deps)* update rust crate serde_json to v1.0.147 ([#81](#81)) - *(deps)* lock file maintenance ([#79](#79)) - *(deps)* update rust crate shell-words to v1.1.1 ([#77](#77)) - *(deps)* lock file maintenance ([#76](#76)) - *(deps)* update rust crate log to v0.4.29 ([#75](#75)) - *(deps)* lock file maintenance ([#73](#73)) - *(deps)* lock file maintenance ([#68](#68)) - *(deps)* lock file maintenance ([#65](#65)) - *(deps)* lock file maintenance ([#62](#62)) - *(deps)* update rust crate clap to v4.5.51 ([#60](#60)) - *(deps)* lock file maintenance ([#59](#59)) - *(deps)* update rust crate clap to v4.5.50 ([#57](#57)) - Update README ([#55](#55)) - *(deps)* lock file maintenance ([#54](#54)) - *(deps)* lock file maintenance ([#47](#47)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Merged
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(),panic!(), andunreachable!()calls with proper error handling to prevent crashes in productionChanges by File
src/ipc/client.rspanic!and 9unreachable!macros withbail!src/ipc/server.rspanic!withbail!src/main.rssrc/supervisor.rssrc/env.rscurrent_exe,current_dir, andhome_dirsrc/state_file.rssrc/procs.rssrc/logger.rssrc/cli/logs.rssrc/cli/config/add.rsTest plan
cargo buildpassescargo clippy -- -D warningspassescargo test- all 34 tests pass🤖 Generated with Claude Code
Note
Strengthens reliability by eliminating panics and adding graceful recovery paths across core subsystems.
panic!/unreachable!withbail!; validate null-bytes; improve connect retry/reporting (src/ipc/{client,server}.rs)upsert_daemonupdates, robust signal setup (Unix/Windows), cron/retry flow preserved (src/supervisor.rs)Systemlock helper, tolerate state file read/parse errors (src/{logger.rs,procs.rs,state_file.rs})current_exe,current_dir,home_dir; safer path display and log file/tail handling; resilient log line parsing and time truncation (src/{env.rs,cli/{config/add.rs,logs.rs}})Written by Cursor Bugbot for commit 4ff7e08. This will update automatically on new commits. Configure here.