Skip to content

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Jan 21, 2026

Description

The file watcher previously used .expect() when setting up the Ctrl+C handler, which could cause a panic in environments where signal handlers cannot be set (e.g., non-TTY contexts, containers). This PR changes the implementation to handle the error gracefully by logging a warning and continuing execution.

Changes

  • Replaced ctrlc::set_handler(...).expect(...) with if let Err(e) = ctrlc::set_handler(...) { eprintln!(...); }
  • Logs a warning message if the signal handler cannot be installed, allowing the application to continue running.

Verification

  • Manual verification: Ran vgrep watch < /dev/null to ensure no regression in normal operation.
  • Code inspection: Verified that the failure path no longer panics.

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.

3 participants