- Add --timeout SECONDS option to pgrep search (default: 2)
- Fix script to exclude its own PID from detection results
- Add file existence check before reading /proc to avoid race condition errors
- Initialize cmdline variable to prevent unbound variable errors
Acceptance criteria PASS:
- Script exists at scripts/check-orphaned-processes.sh ✓
- Is executable (chmod +x) ✓
- Searches for patterns: 'pdftract mcp', 'TH-0', 'TH_0' ✓
- Returns exit code 0 when no orphans, 1 when orphans detected ✓
- Outputs process details (PID, command, args) when found ✓
- Script is documented with usage comments at top ✓
- Accepts optional timeout parameter ✓