Project
vgrep
Description
The file watcher in src/watcher.rs line 65 uses .expect() when setting up the Ctrl+C handler. This can panic and crash the application when running in environments where signal handlers cannot be set (e.g., certain containerized environments, non-TTY contexts, or when another handler is already registered).
Error Message
thread 'main' panicked at 'Error setting Ctrl+C handler: ...'
Debug Logs
System Information
- Bounty Version: 0.1.0
- OS: Ubuntu 24.04 LTS
- Rust: 1.75+
Screenshots
No response
Steps to Reproduce
- Run vgrep watch in a non-TTY environment:
or
- In some environments, this will panic when trying to set the signal handler
Expected Behavior
The application should handle signal handler setup failures gracefully:
- Log a warning that graceful shutdown won't work
- Continue running without the signal handler
- Document alternative ways to stop the watcher (kill -9, etc.)
Actual Behavior
Application panics and terminates if signal handler cannot be set, preventing the watcher from running at all in certain environments.
Additional Context
Environments where this might fail:
- Docker containers without TTY (
docker run without -it)
- CI/CD pipelines
- Background service execution
- Environments with existing signal handlers
- Some Windows configurations
The ctrlc crate itself documents that set_handler can fail in various scenarios. Using .expect() is overly strict for what is essentially a convenience feature.
Project
vgrep
Description
The file watcher in
src/watcher.rsline 65 uses.expect()when setting up the Ctrl+C handler. This can panic and crash the application when running in environments where signal handlers cannot be set (e.g., certain containerized environments, non-TTY contexts, or when another handler is already registered).Error Message
Debug Logs
System Information
Screenshots
No response
Steps to Reproduce
vgrep watch < /dev/nullExpected Behavior
The application should handle signal handler setup failures gracefully:
Actual Behavior
Application panics and terminates if signal handler cannot be set, preventing the watcher from running at all in certain environments.
Additional Context
Environments where this might fail:
docker runwithout-it)The ctrlc crate itself documents that
set_handlercan fail in various scenarios. Using.expect()is overly strict for what is essentially a convenience feature.