HomeFreeBSD

MFC r322210,r322613,r322831:

Description

MFC r322210,r322613,r322831:

pgrep naively appends the delimiter to all PIDs including the last
e.g. "pgrep -d, getty" outputs "1399,1386,1309,1308,1307,1306,1305,1302,"
Ensure the list is correctly delimited by suppressing the emission of the
delimiter after the final PID.

The r322210 change to pgrep's PID delimiting behaviour causes pgrep's default
output to not include a trailing new line, which is a potential POLA violation
for existing consumers. Change pgrep to always emit a trailing new line on
completion of its output, regardless of the delimeter in use (which technically
is also a potential POLA violation for existing consumers that rely on the
pre-r322210 buggy behaviour, but a line has to be drawn somewhere).

Only emit the trailing new line added in r322613 when not operating in quiet
mode.

PR: 221534 (r322613)

Details

Provenance
eadlerAuthored on
Parents
rS330323: MFC r321426:
Branches
Unknown
Tags
Unknown