Make "PhutilProcessQuery" detection of overseer processes more robust


Make "PhutilProcessQuery" detection of overseer processes more robust

Ref T13321. Since "just use the process list" is looking a whole lot more attractive than PID files, improve the robustness of the query when identifying overseers.

Currently, we could incorrectly identify processes like "grep phd-daemon" as overseers.

To fix this, don't just look for "\bphd-daemon\b" anywhere in the process title: require the first argument be a path that ends in "phd-daemon", or the first two arguments end in "php phd-daemon".

Test Plan:

  • Added unit tests, ran unit tests. Ran bin/phd status, saw it identify processes correctly.
  • Ran sleep 60/phd-daemon.
  • Before: bin/phd status reported this as a daemon.
  • After: bin/phd status no longer believes this is a daemon.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13321

Differential Revision: https://secure.phabricator.com/D20616