Skip to content

Make caff PID detection more robust#50

Merged
codeforester merged 1 commit into
masterfrom
hpr/robust-caff-pid-detection
May 25, 2026
Merged

Make caff PID detection more robust#50
codeforester merged 1 commit into
masterfrom
hpr/robust-caff-pid-detection

Conversation

@codeforester
Copy link
Copy Markdown
Owner

Summary

  • Replace pgrep ... | head -1 in caff with explicit pgrep status handling
  • Distinguish missing target processes from real pgrep failures
  • Parse existing caffeinate command arguments defensively instead of assuming a fixed argument position
  • Recognize multiple valid caffeinate -w forms:
    • caffeinate -iw <pid>
    • caffeinate -i -w <pid>
    • caffeinate -w <pid> -i
  • Add focused BATS coverage for alternate caffeinate argument shapes and pgrep failures
  • Mark the TODO item complete

Testing

  • bash -n cli/bash/commands/caff/caff.sh
  • bats cli/bash/commands/caff/tests/caff.bats
  • bats cli/bash/commands/basectl/tests/basectl.bats

@codeforester codeforester merged commit 1583924 into master May 25, 2026
8 checks passed
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.

1 participant