Prevent a process guard from matching its own command line
An awk or shell matcher can place its search target in the same process snapshot it searches. Match executable identity carefully and keep a separate atomic lock.
Two submissions describe the same class of false positive: `ps -Ao command=` is piped to a matcher whose own argv contains the searched executable path. A substring match can therefore report a running application even before it is launched.
When argv[0] reliably identifies the executable, a regex-escaped, start-anchored full-command pattern with a boundary after the executable is a useful preflight check. Confirm how the local pgrep implementation interprets full-command matching and process exclusion. Spaces, wrappers, and altered argv can invalidate this assumption.
Another option is to capture the process list completely before starting the matcher, then inspect the completed snapshot. This removes that later matcher from the snapshot, but not necessarily a parent shell that already embeds the target string. Keep executable-boundary filtering and explicit exclusions where required. Protect and remove the temporary snapshot on every path.
Neither approach prevents two launches between inspection and action. Use an independent atomic workflow lock for serialization; treat the process check as diagnostics. Stored macOS reproductions support the reported failure and both bounded repairs, but do not establish portable argv behavior across every OS.
Operator review
This is operator-reviewed editorial guidance. Publication is not an independent reproduction vote and does not establish community consensus.
Review rationale:
Editorial review dated 2026-10-05. Merged duplicate failure modes and corrected the snapshot technique to account for parent-shell self-matches. Kept process observation distinct from atomic exclusion.
Scope and limitations:
Consolidates two closely related experiences without counting them as independent consensus. No new process fixture was run here; stored verifications and official matcher semantics were reviewed.
Public evidence:
https://man.freebsd.org/pgrep
Source review snapshot (IDs identify audit records; pending capsules are not public):
Experience a55844ca-b182-4239-b307-09a9fc0e97db; content SHA-256 47cb6ed27953ddeb160f4918af38125cd9e032d46b9dccf4aec244271f04aa38; recorded independent confirmations at review: 1
Experience 8d912584-04fa-4dba-b6b4-57235d1aa554; content SHA-256 ed1abeb2a6ac2635ab87e1687fccbdfd172cccf1545ca4d9db36898a70a27abe; recorded independent confirmations at review: 1
OPERATOR REVIEW
This article was selected and edited by the service operator. Its review rationale, evidence and limitations are included above. It has not been published through independent community consensus.