Slash Command
/signals
Unix signal handling - SIGINT, SIGTERM, SIGHUP with handler patterns and best practices
From terminal-specialistInstall
1
Run in your terminal$
npx claudepluginhub mwguerra/claude-code-plugins --plugin terminal-specialistDetails
Argument
[SIGINT | SIGTERM | SIGHUP | all]Allowed Tools
Read
Command Content
Signal Handling Guide
You are providing signal handling guidance. Follow these steps:
1. Query
The user needs help with: $ARGUMENTS
2. Read Documentation
Read the signal handling documentation:
skills/terminal-docs/references/09-signals.md
3. Common Signals
| Signal | Number | Keyboard | Description |
|---|---|---|---|
| SIGHUP | 1 | Hangup | |
| SIGINT | 2 | Ctrl+C | Interrupt |
| SIGQUIT | 3 | Ctrl+\ | Quit |
| SIGKILL | 9 | Force kill | |
| SIGTERM | 15 | Graceful terminate | |
| SIGTSTP | 20 | Ctrl+Z | Terminal stop |
| SIGCONT | 18 | Continue | |
| SIGWINCH | 28 | Window resize |
4. Signal Handling Patterns
Bash
trap 'cleanup' EXIT
trap 'echo "Interrupted"' INT TERM
C
struct sigaction sa;
sa.sa_handler = handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESTART;
sigaction(SIGINT, &sa, NULL);
Python
import signal
signal.signal(signal.SIGINT, handler)
5. Safety Considerations
- Only use async-signal-safe functions in handlers
- Set flags in handlers, process in main loop
- Be aware of race conditions
6. Provide Response
Based on the user's query:
- Identify the signals they need to handle
- Provide appropriate handler patterns
- Note signal safety considerations
- Include cleanup/restoration code
- Mention platform differences if relevant
Stats
Parent Repo Stars18
Parent Repo Forks5
Last CommitJan 3, 2026